Skip to content

Commit 9205b02

Browse files
jkotalikguardrexJamesNKRick-Anderson
authored
Server Reset/Trailers docs (#20059)
* HTTP.SYS and IIS docs * fixups * Updates * Updates * Update * feedback * Feedback * Feedback * fb * fix path * protocols * oops * Update aspnetcore/includes/trailers.md Co-authored-by: James Newton-King <james@newtonking.com> * Update protocols.md (#20079) * Update protocols.md * Update protocols.md * Apply suggestions from code review Co-authored-by: Luke Latham <llatham@aquent.com> * Apply suggestions from code review Co-authored-by: Luke Latham <llatham@aquent.com> * Update aspnetcore/host-and-deploy/iis/protocols.md Co-authored-by: Luke Latham <llatham@aquent.com> Co-authored-by: Luke Latham <llatham@aquent.com> Co-authored-by: Luke Latham <llatham@aquent.com> Co-authored-by: James Newton-King <james@newtonking.com> Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
1 parent 9203ff2 commit 9205b02

7 files changed

Lines changed: 102 additions & 19 deletions

File tree

aspnetcore/fundamentals/servers/httpsys.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,23 @@ In Visual Studio, the default launch profile is for IIS Express. To run the proj
256256

257257
For apps hosted by HTTP.sys that interact with requests from the Internet or a corporate network, additional configuration might be required when hosting behind proxy servers and load balancers. For more information, see [Configure ASP.NET Core to work with proxy servers and load balancers](xref:host-and-deploy/proxy-load-balancer).
258258

259+
## Advanced HTTP/2 features to support gRPC
260+
261+
Additional HTTP/2 features in HTTP.sys support gRPC, including support for response trailers and sending reset frames.
262+
263+
Requirements to run gRPC with HTTP.SYS:
264+
265+
* Windows 10, OS Build 19041.508 or later
266+
* TLS 1.2 or later connection
267+
268+
### Trailers
269+
270+
[!INCLUDE[](~/includes/trailers.md)]
271+
272+
### Reset
273+
274+
[!INCLUDE[](~/includes/reset.md)]
275+
259276
## Additional resources
260277

261278
* [Enable Windows Authentication with HTTP.sys](xref:security/authentication/windowsauth#httpsys)
@@ -1021,4 +1038,4 @@ For apps hosted by HTTP.sys that interact with requests from the Internet or a c
10211038
* [The host](xref:fundamentals/index#host)
10221039
* <xref:test/troubleshoot>
10231040

1024-
::: moniker-end
1041+
::: moniker-end

aspnetcore/fundamentals/servers/kestrel.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,14 @@ webBuilder.ConfigureKestrel(serverOptions =>
340340

341341
The default value is 96 KB (98,304).
342342

343+
### Trailers
344+
345+
[!INCLUDE[](~/includes/trailers.md)]
346+
347+
### Reset
348+
349+
[!INCLUDE[](~/includes/reset.md)]
350+
343351
### Synchronous I/O
344352

345353
<xref:Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions.AllowSynchronousIO> controls whether synchronous I/O is allowed for the request and response. The default value is `false`.

aspnetcore/host-and-deploy/iis/index.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -533,24 +533,6 @@ ICACLS C:\sites\MyWebApp /grant "IIS AppPool\DefaultAppPool":F
533533

534534
For more information, see the [icacls](/windows-server/administration/windows-commands/icacls) topic.
535535

536-
## HTTP/2 support
537-
538-
[HTTP/2](https://httpwg.org/specs/rfc7540.html) is supported with ASP.NET Core in the following IIS deployment scenarios:
539-
540-
* In-process
541-
* Windows Server 2016/Windows 10 or later; IIS 10 or later
542-
* TLS 1.2 or later connection
543-
* Out-of-process
544-
* Windows Server 2016/Windows 10 or later; IIS 10 or later
545-
* Public-facing edge server connections use HTTP/2, but the reverse proxy connection to the [Kestrel server](xref:fundamentals/servers/kestrel) uses HTTP/1.1.
546-
* TLS 1.2 or later connection
547-
548-
For an in-process deployment when an HTTP/2 connection is established, [HttpRequest.Protocol](xref:Microsoft.AspNetCore.Http.HttpRequest.Protocol*) reports `HTTP/2`. For an out-of-process deployment when an HTTP/2 connection is established, [HttpRequest.Protocol](xref:Microsoft.AspNetCore.Http.HttpRequest.Protocol*) reports `HTTP/1.1`.
549-
550-
For more information on the in-process and out-of-process hosting models, see <xref:host-and-deploy/aspnet-core-module>.
551-
552-
HTTP/2 is enabled by default. Connections fall back to HTTP/1.1 if an HTTP/2 connection isn't established. For more information on HTTP/2 configuration with IIS deployments, see [HTTP/2 on IIS](/iis/get-started/whats-new-in-iis-10/http2-on-iis).
553-
554536
## CORS preflight requests
555537

556538
*This section only applies to ASP.NET Core apps that target the .NET Framework.*
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Use ASP.NET Core with HTTP/2 on IIS
3+
author: rick-anderson
4+
description: Learn how to use HTTP/2 features with IIS.
5+
monikerRange: '>= aspnetcore-5.0'
6+
ms.author: riande
7+
ms.custom: mvc
8+
ms.date: 01/13/2020
9+
no-loc: ["ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR]
10+
uid: host-and-deploy/iis/protocols
11+
---
12+
13+
# Use ASP.NET Core with HTTP/2 on IIS
14+
15+
By [Justin Kotalik](https://github.com/jkotalik)
16+
17+
[HTTP/2](https://httpwg.org/specs/rfc7540.html) is supported with ASP.NET Core in the following IIS deployment scenarios:
18+
19+
* Windows Server 2016 or later / Windows 10 or later
20+
* IIS 10 or later
21+
* TLS 1.2 or later connection
22+
* When [hosting out-of-process](xref:host-and-deploy/iis/index#out-of-process-hosting-model): Public-facing edge server connections use HTTP/2, but the reverse proxy connection to the [Kestrel server](xref:fundamentals/servers/kestrel) uses HTTP/1.1.
23+
24+
For an in-process deployment when an HTTP/2 connection is established, [`HttpRequest.Protocol`](xref:Microsoft.AspNetCore.Http.HttpRequest.Protocol*) reports `HTTP/2`. For an out-of-process deployment when an HTTP/2 connection is established, [`HttpRequest.Protocol`](xref:Microsoft.AspNetCore.Http.HttpRequest.Protocol*) reports `HTTP/1.1`.
25+
26+
For more information on the in-process and out-of-process hosting models, see <xref:host-and-deploy/aspnet-core-module>.
27+
28+
HTTP/2 is enabled by default for HTTPS/TLS connections. Connections fall back to HTTP/1.1 if an HTTP/2 connection isn't established. For more information on HTTP/2 configuration with IIS deployments, see [HTTP/2 on IIS](/iis/get-started/whats-new-in-iis-10/http2-on-iis).
29+
30+
## Advanced HTTP/2 features to support gRPC
31+
32+
Additional HTTP/2 features in IIS support gRPC, including support for response trailers and sending reset frames.
33+
34+
Requirements to run gRPC on IIS:
35+
36+
* In-process hosting.
37+
* Windows 10, OS Build 20300.1000 or later. May require use of Windows Insider Builds.
38+
* TLS 1.2 or later connection
39+
40+
### Trailers
41+
42+
[!INCLUDE[](~/includes/trailers.md)]
43+
44+
### Reset
45+
46+
[!INCLUDE[](~/includes/reset.md)]

aspnetcore/includes/reset.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Reset allows for the server to reset a HTTP/2 request with a specified error code. A reset request is considered aborted.
2+
3+
```csharp
4+
var resetFeature = httpContext.Features.Get<IHttpResetFeature>();
5+
resetFeature.Reset(errorCode: 2);
6+
```
7+
8+
`Reset` in the preceding code example specifies the `INTERNAL_ERROR` error code. For more information about HTTP/2 error codes, visit the [HTTP/2 specification error code section](https://tools.ietf.org/html/rfc7540#page-50).

aspnetcore/includes/trailers.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
HTTP Trailers are similar to HTTP Headers, except they are sent after the response body is sent. For IIS and HTTP.SYS, only HTTP/2 response trailers are supported.
2+
3+
```csharp
4+
if (httpContext.Response.SupportsTrailers())
5+
{
6+
httpContext.Response.DeclareTrailer("trailername");
7+
8+
// Write body
9+
httpContext.Response.WriteAsync("Hello world");
10+
11+
httpContext.Response.AppendTrailer("trailername", "TrailerValue");
12+
}
13+
```
14+
15+
In the preceding example code:
16+
17+
* `SupportsTrailers` ensures that trailers are supported for the response.
18+
* `DeclareTrailer` adds the given trailer name to the `Trailer` response header. Declaring a response's trailers is optional, but recommended. If `DeclareTrailer` is called, it must be before the response headers are sent.
19+
* `AppendTrailer` appends the trailer.

aspnetcore/toc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,9 @@
933933
- name: Transform web.config
934934
displayName: deploy, publish
935935
uid: host-and-deploy/iis/transform-webconfig
936+
- name: HTTP/2
937+
displayName: deploy, publish
938+
uid: host-and-deploy/iis/protocols
936939
- name: Kestrel
937940
uid: fundamentals/servers/kestrel
938941
displayName: deploy, publish, server

0 commit comments

Comments
 (0)