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
parent
680a261f43
commit
dcfd20a564
|
@ -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 <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.
|
||||
|
|
|
@ -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();
|
||||
}
|
Loading…
Reference in New Issue