diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index f51654e9bd..8a42334d3a 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -491,6 +491,25 @@ Output caching is a new middleware that stores responses from a web app and serv For more information, see [Overview of caching](xref:performance/caching/overview) and [Output caching middleware](xref:performance/caching/output). +### HTTP/3 improvements + +This release: + +* Makes HTTP/3 fully supported by ASP.NET Core, it's no longer experimental. +* Improves Kestrel’s support for HTTP/3. The two main areas of improvement are feature parity with HTTP/1.1 and HTTP/2, and performance. +* Provides full support for with HTTP/3. Kestrel offers advanced options for configuring connection certificates, such as hooking into [Server Name Indication (SNI)](https://wikipedia.org/wiki/Server_Name_Indication). +* Adds support for HTTP/3 on [HTTP.sys](xref:fundamentals/servers/httpsys) and [IIS](xref:host-and-deploy/iis/modules). + +The following example shows how to use an SNI callback to resolve TLS options: + +:::code language="csharp" source="~/release-notes/sample/Program7.cs" id="snippet_1"::: + +Significant work was done in .NET 7 to reduce HTTP/3 allocations. You can see some of those improvements in the following GitHub PR's: + +* [HTTP/3: Avoid per-request cancellation token allocations](https://github.com/dotnet/aspnetcore/pull/42685) +* [HTTP/3: Avoid ConnectionAbortedException allocations](https://github.com/dotnet/aspnetcore/pull/42708) +* [HTTP/3: ValueTask pooling](https://github.com/dotnet/aspnetcore/pull/42760) + ### HTTP/2 Performance improvements .NET 7 introduces a significant re-architecture of how Kestrel processes HTTP/2 requests. ASP.NET Core apps with busy HTTP/2 connections will experience reduced CPU usage and higher throughput. diff --git a/aspnetcore/release-notes/sample/Program7.cs b/aspnetcore/release-notes/sample/Program7.cs new file mode 100644 index 0000000000..307f8aef1c --- /dev/null +++ b/aspnetcore/release-notes/sample/Program7.cs @@ -0,0 +1,38 @@ +// +using Microsoft.AspNetCore.Server.Kestrel.Core; +using Microsoft.AspNetCore.Server.Kestrel.Https; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +var builder = WebApplication.CreateBuilder(args); +builder.WebHost.ConfigureKestrel(options => +{ + options.ListenAnyIP(8080, listenOptions => + { + listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3; + listenOptions.UseHttps(new TlsHandshakeCallbackOptions + { + OnConnection = context => + { + var options = new SslServerAuthenticationOptions + { + ServerCertificate = + MyResolveCertForHost(context.ClientHelloInfo.ServerName) + }; + return new ValueTask(options); + }, + }); + }); +}); +// + +var app = builder.Build(); + +app.MapGet("/", () => "Hello World!"); + +app.Run(); + +X509Certificate MyResolveCertForHost(string serverName) +{ + throw new NotImplementedException(); +} \ No newline at end of file