Skip to content

Commit 58fa78e

Browse files
authored
Coalesce hosting model coverage (dotnet#12573)
1 parent 9642f88 commit 58fa78e

File tree

10 files changed

+106
-123
lines changed

10 files changed

+106
-123
lines changed

aspnetcore/fundamentals/servers/index.md

Lines changed: 25 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
title: Web server implementations in ASP.NET Core
33
author: guardrex
44
description: Discover the web servers Kestrel and HTTP.sys for ASP.NET Core. Learn how to choose a server and when to use a reverse proxy server.
5+
monikerRange: '>= aspnetcore-2.1'
56
ms.author: tdykstra
67
ms.custom: mvc
7-
ms.date: 05/24/2019
8+
ms.date: 06/01/2019
89
uid: fundamentals/servers/index
910
---
1011
# Web server implementations in ASP.NET Core
@@ -13,63 +14,48 @@ By [Tom Dykstra](https://github.com/tdykstra), [Steve Smith](https://ardalis.com
1314

1415
An ASP.NET Core app runs with an in-process HTTP server implementation. The server implementation listens for HTTP requests and surfaces them to the app as a set of [request features](xref:fundamentals/request-features) composed into an <xref:Microsoft.AspNetCore.Http.HttpContext>.
1516

16-
::: moniker range=">= aspnetcore-2.2"
17-
18-
# [Windows](#tab/windows)
19-
20-
ASP.NET Core ships with the following:
21-
22-
* [Kestrel server](xref:fundamentals/servers/kestrel) is the default, cross-platform HTTP server implementation.
23-
* IIS HTTP Server is an [in-process server](#in-process-hosting-model) for IIS.
24-
* [HTTP.sys server](xref:fundamentals/servers/httpsys) is a Windows-only HTTP server based on the [HTTP.sys kernel driver and HTTP Server API](/windows/desktop/Http/http-api-start-page).
25-
26-
When using [IIS](/iis/get-started/introduction-to-iis/introduction-to-iis-architecture) or [IIS Express](/iis/extensions/introduction-to-iis-express/iis-express-overview), the app either runs:
27-
28-
* In the same process as the IIS worker process (the [in-process hosting model](#in-process-hosting-model)) with the [IIS HTTP Server](#iis-http-server). *In-process* is the recommended configuration.
29-
* In a process separate from the IIS worker process (the [out-of-process hosting model](#out-of-process-hosting-model)) with the [Kestrel server](#kestrel).
30-
31-
The [ASP.NET Core Module](xref:host-and-deploy/aspnet-core-module) is a native IIS module that handles native IIS requests between IIS and the in-process IIS HTTP Server or Kestrel. For more information, see <xref:host-and-deploy/aspnet-core-module>.
17+
## Kestrel
3218

33-
## Hosting models
19+
Kestrel is the default web server included in ASP.NET Core project templates.
3420

35-
### In-process hosting model
21+
Use Kestrel:
3622

37-
Using in-process hosting, an ASP.NET Core app runs in the same process as its IIS worker process. In-process hosting provides improved performance over out-of-process hosting because requests aren't proxied over the loopback adapter, a network interface that returns outgoing network traffic back to the same machine. IIS handles process management with the [Windows Process Activation Service (WAS)](/iis/manage/provisioning-and-managing-iis/features-of-the-windows-process-activation-service-was).
23+
* By itself as an edge server processing requests directly from a network, including the Internet.
3824

39-
The ASP.NET Core Module:
25+
![Kestrel communicates directly with the Internet without a reverse proxy server](kestrel/_static/kestrel-to-internet2.png)
4026

41-
* Performs app initialization.
42-
* Loads the [CoreCLR](/dotnet/standard/glossary#coreclr).
43-
* Calls `Program.Main`.
44-
* Handles the lifetime of the IIS native request.
27+
* With a *reverse proxy server*, such as [Internet Information Services (IIS)](https://www.iis.net/), [Nginx](http://nginx.org), or [Apache](https://httpd.apache.org/). A reverse proxy server receives HTTP requests from the Internet and forwards them to Kestrel.
4528

46-
The in-process hosting model isn't supported for ASP.NET Core apps that target the .NET Framework.
29+
![Kestrel communicates indirectly with the Internet through a reverse proxy server, such as IIS, Nginx, or Apache](kestrel/_static/kestrel-to-internet.png)
4730

48-
The following diagram illustrates the relationship between IIS, the ASP.NET Core Module, and an app hosted in-process:
31+
Either hosting configuration&mdash;with or without a reverse proxy server&mdash;is supported for ASP.NET Core 2.1 or later apps.
4932

50-
![ASP.NET Core Module](_static/ancm-inprocess.png)
33+
For Kestrel configuration guidance and information on when to use Kestrel in a reverse proxy configuration, see <xref:fundamentals/servers/kestrel>.
5134

52-
A request arrives from the web to the kernel-mode HTTP.sys driver. The driver routes the native request to IIS on the website's configured port, usually 80 (HTTP) or 443 (HTTPS). The module receives the native request and passes it to IIS HTTP Server (`IISHttpServer`). IIS HTTP Server is an in-process server implementation for IIS that converts the request from native to managed.
35+
::: moniker range=">= aspnetcore-2.2"
5336

54-
After the IIS HTTP Server processes the request, the request is pushed into the ASP.NET Core middleware pipeline. The middleware pipeline handles the request and passes it on as an `HttpContext` instance to the app's logic. The app's response is passed back to IIS through IIS HTTP Server. IIS sends the response to the client that initiated the request.
37+
# [Windows](#tab/windows)
5538

56-
In-process hosting is opt-in for existing apps, but [dotnet new](/dotnet/core/tools/dotnet-new) templates default to the in-process hosting model for all IIS and IIS Express scenarios.
39+
ASP.NET Core ships with the following:
5740

58-
### Out-of-process hosting model
41+
* [Kestrel server](xref:fundamentals/servers/kestrel) is the default, cross-platform HTTP server implementation.
42+
* IIS HTTP Server is an [in-process server](#hosting-models) for IIS.
43+
* [HTTP.sys server](xref:fundamentals/servers/httpsys) is a Windows-only HTTP server based on the [HTTP.sys kernel driver and HTTP Server API](/windows/desktop/Http/http-api-start-page).
5944

60-
Because ASP.NET Core apps run in a process separate from the IIS worker process, the module handles process management. The module starts the process for the ASP.NET Core app when the first request arrives and restarts the app if it shuts down or crashes. This is essentially the same behavior as seen with apps that run in-process that are managed by the [Windows Process Activation Service (WAS)](/iis/manage/provisioning-and-managing-iis/features-of-the-windows-process-activation-service-was).
45+
When using [IIS](/iis/get-started/introduction-to-iis/introduction-to-iis-architecture) or [IIS Express](/iis/extensions/introduction-to-iis-express/iis-express-overview), the app either runs:
6146

62-
The following diagram illustrates the relationship between IIS, the ASP.NET Core Module, and an app hosted out-of-process:
47+
* In the same process as the IIS worker process (the [in-process hosting model](#hosting-models)) with the IIS HTTP Server. *In-process* is the recommended configuration.
48+
* In a process separate from the IIS worker process (the [out-of-process hosting model](#hosting-models)) with the [Kestrel server](#kestrel).
6349

64-
![ASP.NET Core Module](_static/ancm-outofprocess.png)
50+
The [ASP.NET Core Module](xref:host-and-deploy/aspnet-core-module) is a native IIS module that handles native IIS requests between IIS and the in-process IIS HTTP Server or Kestrel. For more information, see <xref:host-and-deploy/aspnet-core-module>.
6551

66-
Requests arrive from the web to the kernel-mode HTTP.sys driver. The driver routes the requests to IIS on the website's configured port, usually 80 (HTTP) or 443 (HTTPS). The module forwards the requests to Kestrel on a random port for the app, which isn't port 80 or 443.
52+
## Hosting models
6753

68-
The module specifies the port via an environment variable at startup, and the <xref:Microsoft.AspNetCore.Hosting.WebHostBuilderIISExtensions.UseIISIntegration*> extension configures the server to listen on `http://localhost:{PORT}`. Additional checks are performed, and requests that don't originate from the module are rejected. The module doesn't support HTTPS forwarding, so requests are forwarded over HTTP even if received by IIS over HTTPS.
54+
Using in-process hosting, an ASP.NET Core app runs in the same process as its IIS worker process. In-process hosting provides improved performance over out-of-process hosting because requests aren't proxied over the loopback adapter, a network interface that returns outgoing network traffic back to the same machine. IIS handles process management with the [Windows Process Activation Service (WAS)](/iis/manage/provisioning-and-managing-iis/features-of-the-windows-process-activation-service-was).
6955

70-
After Kestrel picks up the request from the module, the request is pushed into the ASP.NET Core middleware pipeline. The middleware pipeline handles the request and passes it on as an `HttpContext` instance to the app's logic. Middleware added by IIS Integration updates the scheme, remote IP, and pathbase to account for forwarding the request to Kestrel. The app's response is passed back to IIS, which pushes it back out to the HTTP client that initiated the request.
56+
Using out-of-process hosting, ASP.NET Core apps run in a process separate from the IIS worker process, and the module handles process management. The module starts the process for the ASP.NET Core app when the first request arrives and restarts the app if it shuts down or crashes. This is essentially the same behavior as seen with apps that run in-process that are managed by the [Windows Process Activation Service (WAS)](/iis/manage/provisioning-and-managing-iis/features-of-the-windows-process-activation-service-was).
7157

72-
For IIS and ASP.NET Core Module configuration guidance, see the following topics:
58+
For more information and configuration guidance, see the following topics:
7359

7460
* <xref:host-and-deploy/iis/index>
7561
* <xref:host-and-deploy/aspnet-core-module>
@@ -126,42 +112,6 @@ ASP.NET Core ships with [Kestrel server](xref:fundamentals/servers/kestrel), whi
126112

127113
::: moniker-end
128114

129-
## Kestrel
130-
131-
Kestrel is the default web server included in ASP.NET Core project templates.
132-
133-
::: moniker range=">= aspnetcore-2.0"
134-
135-
Kestrel can be used:
136-
137-
* By itself as an edge server processing requests directly from a network, including the Internet.
138-
139-
![Kestrel communicates directly with the Internet without a reverse proxy server](kestrel/_static/kestrel-to-internet2.png)
140-
141-
* With a *reverse proxy server*, such as [Internet Information Services (IIS)](https://www.iis.net/), [Nginx](http://nginx.org), or [Apache](https://httpd.apache.org/). A reverse proxy server receives HTTP requests from the Internet and forwards them to Kestrel.
142-
143-
![Kestrel communicates indirectly with the Internet through a reverse proxy server, such as IIS, Nginx, or Apache](kestrel/_static/kestrel-to-internet.png)
144-
145-
Either hosting configuration&mdash;with or without a reverse proxy server&mdash;is supported for ASP.NET Core 2.1 or later apps.
146-
147-
::: moniker-end
148-
149-
::: moniker range="< aspnetcore-2.0"
150-
151-
If the app only accepts requests from an internal network, Kestrel can be used by itself.
152-
153-
![Kestrel communicates directly with the internal network](kestrel/_static/kestrel-to-internal.png)
154-
155-
If the app is exposed to the Internet, Kestrel must use a *reverse proxy server*, such as [Internet Information Services (IIS)](https://www.iis.net/), [Nginx](http://nginx.org), or [Apache](https://httpd.apache.org/). A reverse proxy server receives HTTP requests from the Internet and forwards them to Kestrel.
156-
157-
![Kestrel communicates indirectly with the Internet through a reverse proxy server, such as IIS, Nginx, or Apache](kestrel/_static/kestrel-to-internet.png)
158-
159-
The most important reason for using a reverse proxy for public-facing edge server deployments that are exposed directly the Internet is security. The 1.x versions of Kestrel don't include important security features to defend against attacks from the Internet. This includes, but isn't limited to, appropriate timeouts, request size limits, and concurrent connection limits.
160-
161-
::: moniker-end
162-
163-
For Kestrel configuration guidance and information on when to use Kestrel in a reverse proxy configuration, see <xref:fundamentals/servers/kestrel>.
164-
165115
### Nginx with Kestrel
166116

167117
For information on how to use Nginx on Linux as a reverse proxy server for Kestrel, see <xref:host-and-deploy/linux-nginx>.
@@ -170,14 +120,6 @@ For information on how to use Nginx on Linux as a reverse proxy server for Kestr
170120

171121
For information on how to use Apache on Linux as a reverse proxy server for Kestrel, see <xref:host-and-deploy/linux-apache>.
172122

173-
::: moniker range=">= aspnetcore-2.2"
174-
175-
## IIS HTTP Server
176-
177-
IIS HTTP Server is an [in-process server](#in-process-hosting-model) for IIS and required for in-process deployments. The [ASP.NET Core Module](xref:host-and-deploy/aspnet-core-module) handles native IIS requests between IIS and IIS HTTP Server. For more information, see <xref:host-and-deploy/aspnet-core-module>.
178-
179-
::: moniker-end
180-
181123
## HTTP.sys
182124

183125
If ASP.NET Core apps are run on Windows, HTTP.sys is an alternative to Kestrel. Kestrel is generally recommended for best performance. HTTP.sys can be used in scenarios where the app is exposed to the Internet and required capabilities are supported by HTTP.sys but not Kestrel. For more information, see <xref:fundamentals/servers/httpsys>.

aspnetcore/fundamentals/servers/kestrel.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn about Kestrel, the cross-platform web server for ASP.NET Core
55
monikerRange: '>= aspnetcore-2.1'
66
ms.author: tdykstra
77
ms.custom: mvc
8-
ms.date: 05/17/2019
8+
ms.date: 05/28/2019
99
uid: fundamentals/servers/kestrel
1010
---
1111
# Kestrel web server implementation in ASP.NET Core
@@ -279,7 +279,7 @@ You can override the setting on a specific request in middleware:
279279

280280
An exception is thrown if you attempt to configure the limit on a request after the app has started to read the request. There's an `IsReadOnly` property that indicates if the `MaxRequestBodySize` property is in read-only state, meaning it's too late to configure the limit.
281281

282-
When an app is run [out-of-process](xref:fundamentals/servers/index#out-of-process-hosting-model) behind the [ASP.NET Core Module](xref:host-and-deploy/aspnet-core-module), Kestrel's request body size limit is disabled because IIS already sets the limit.
282+
When an app is run [out-of-process](xref:host-and-deploy/iis/index#out-of-process-hosting-model) behind the [ASP.NET Core Module](xref:host-and-deploy/aspnet-core-module), Kestrel's request body size limit is disabled because IIS already sets the limit.
283283

284284
### Minimum request body data rate
285285

aspnetcore/host-and-deploy/azure-apps/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: This article contains links to Azure host and deploy resources.
55
monikerRange: '>= aspnetcore-2.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 03/30/2019
8+
ms.date: 05/28/2019
99
uid: host-and-deploy/azure-apps/index
1010
---
1111
# Deploy ASP.NET Core apps to Azure App Service
@@ -74,7 +74,7 @@ When an app uses the [Generic Host](xref:fundamentals/host/generic-host), enviro
7474

7575
## Proxy server and load balancer scenarios
7676

77-
The [IIS Integration Middleware](xref:host-and-deploy/iis/index#enable-the-iisintegration-components), which configures Forwarded Headers Middleware when hosting [out-of-process](xref:fundamentals/servers/index#out-of-process-hosting-model), and the ASP.NET Core Module are configured to forward the scheme (HTTP/HTTPS) and the remote IP address where the request originated. Additional configuration might be required for apps hosted behind additional 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).
77+
The [IIS Integration Middleware](xref:host-and-deploy/iis/index#enable-the-iisintegration-components), which configures Forwarded Headers Middleware when hosting [out-of-process](xref:host-and-deploy/iis/index#out-of-process-hosting-model), and the ASP.NET Core Module are configured to forward the scheme (HTTP/HTTPS) and the remote IP address where the request originated. Additional configuration might be required for apps hosted behind additional 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).
7878

7979
## Monitoring and logging
8080

0 commit comments

Comments
 (0)