|
1 | 1 | --- |
2 | 2 | title: Use HTTP/3 with the ASP.NET Core Kestrel web server |
| 3 | +ai-usage: ai-assisted |
3 | 4 | author: wtgodbe |
4 | 5 | description: Learn about using HTTP/3 with Kestrel, the cross-platform web server for ASP.NET Core. |
5 | 6 | monikerRange: '>= aspnetcore-6.0' |
6 | 7 | ms.author: wigodbe |
7 | 8 | ms.custom: mvc, linux-related-content |
8 | | -ms.date: 06/08/2025 |
| 9 | +ms.date: 11/13/2025 |
9 | 10 | uid: fundamentals/servers/kestrel/http3 |
10 | 11 | --- |
11 | 12 |
|
@@ -64,6 +65,25 @@ Because not all routers, firewalls, and proxies properly support HTTP/3, HTTP/3 |
64 | 65 |
|
65 | 66 | For more information, see <xref:fundamentals/servers/kestrel/endpoints>. |
66 | 67 |
|
| 68 | +## Configure QuicTransportOptions |
| 69 | + |
| 70 | +QUIC transport options can be configured by calling the <xref:Microsoft.AspNetCore.Hosting.WebHostBuilderQuicExtensions.UseQuic%2A> extension method on <xref:Microsoft.AspNetCore.Hosting.IWebHostBuilder>. |
| 71 | + |
| 72 | +:::code language="csharp" source="samples/6.x/KestrelSample/Snippets/Program.cs" id="snippet_UseQuicWithOptions" highlight="3-8"::: |
| 73 | + |
| 74 | +The following table describes the available <xref:Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions>. |
| 75 | + |
| 76 | +| Option | Default | Description | |
| 77 | +| ------ | ------- | ----------- | |
| 78 | +| <xref:Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.MaxBidirectionalStreamCount> | `100` | The maximum number of concurrent bidirectional streams per connection. | |
| 79 | +| <xref:Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.MaxUnidirectionalStreamCount> | `10` | The maximum number of concurrent inbound unidirectional streams per connection. | |
| 80 | +| <xref:Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.MaxReadBufferSize> | `1024 * 1024` (1 MB) | The maximum read buffer size in bytes. | |
| 81 | +| <xref:Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.MaxWriteBufferSize> | `64 * 1024` (64 KB) | The maximum write buffer size in bytes. | |
| 82 | +| <xref:Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.Backlog> | `512` | The maximum length of the pending connection queue. | |
| 83 | +| <xref:Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.DefaultStreamErrorCode> | `0x010c` (H3_REQUEST_CANCELLED) | Error code used when the stream should abort the read or write side of the stream internally. | |
| 84 | +| <xref:Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.QuicTransportOptions.DefaultCloseErrorCode> | `0x100` (H3_NO_ERROR) | Error code used when an open connection is disposed. | |
| 85 | + |
| 86 | + |
67 | 87 | ## Alt-svc |
68 | 88 |
|
69 | 89 | HTTP/3 is discovered as an upgrade from HTTP/1.1 or HTTP/2 via the [`alt-svc`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Alt-Svc) header. That means the first request will normally use HTTP/1.1 or HTTP/2 before switching to HTTP/3. Kestrel automatically adds the `alt-svc` header if HTTP/3 is enabled. |
|
0 commit comments