What's new HTTP/3 (#27482)

* What's new HTTP/3

* What's new HTTP/3

* What's new HTTP/3

* What's new HTTP/3

* What's new HTTP/3

* What's new HTTP/3

* Update aspnetcore/release-notes/aspnetcore-7.0.md

Co-authored-by: James Newton-King <james@newtonking.com>

* What's new HTTP/3

* Update aspnetcore/release-notes/aspnetcore-7.0.md

Co-authored-by: James Newton-King <james@newtonking.com>

Co-authored-by: James Newton-King <james@newtonking.com>
pull/27484/head
Rick Anderson 2022-11-02 19:07:24 -10:00 committed by GitHub
parent 680a261f43
commit dcfd20a564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 0 deletions

View File

@ -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 Kestrels 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 <xref:Microsoft.AspNetCore.Hosting.ListenOptionsHttpsExtensions.UseHttps(Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions,System.Security.Cryptography.X509Certificates.X509Certificate2)> 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.

View File

@ -0,0 +1,38 @@
// <snippet_1>
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<SslServerAuthenticationOptions>(options);
},
});
});
});
// </snippet_1>
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
X509Certificate MyResolveCertForHost(string serverName)
{
throw new NotImplementedException();
}