Servers - Overview

In this article

An ASP.NET Core app runs with an in-process HTTP server implementation.

Kestrel vs. HTTP.sys

Hosting models

Kestrel

HTTP.sys is the default, cross-platform HTTP server implementation.

Use Kestrel:

Kestrel communicates directly with the Internet without a reverse proxy server!

Kestrel communicates indirectly with the Internet through a reverse proxy server, such as IIS, Nginx, or Apache!

Either hosting configuration—with or without a reverse proxy server—is supported.

For Kestrel configuration guidance and information on when to use Kestrel in a reverse proxy configuration, see Kestrel web server in ASP.NET Core.

Nginx with Kestrel

For information on how to use Nginx on Linux as a reverse proxy server for Kestrel, see Host ASP.NET Core on Linux with Nginx.

HTTP.sys

HTTP.sys is a web server implementation in ASP.NET Core.

HTTP.sys communicates directly with the Internet!

HTTP.sys can also be used for apps that are only exposed to an internal network.

HTTP.sys communicates directly with the internal network!

For HTTP.sys configuration guidance, see HTTP.sys web server implementation in ASP.NET Core.

ASP.NET Core server infrastructure

The IApplicationBuilder available in the Startup.Configure method exposes the ServerFeatures property of type IFeatureCollection. Kestrel and HTTP.sys only expose a single feature each, IServerAddressesFeature, but different server implementations may expose additional functionality.

IServerAddressesFeature can be used to find out which port the server implementation has bound at runtime.

Custom servers

A Nowin-based IServer implementation makes it easy to write web apps that use built-in servers.

Server startup

The server is launched when the Integrated Development Environment (IDE) or editor starts the app:

When launching the app from a command prompt in the project's folder, dotnet run launches the app and server (Kestrel and HTTP.sys only). The configuration is specified by the -c|--configuration option, which is set to either Debug (default) or Release.

A launchSettings.json file provides configuration when launching an app with dotnet run or with a debugger built into tooling, such as Visual Studio. If launch profiles are present in a launchSettings.json file, use the --launch-profile {PROFILE NAME} option with the dotnet run command or select the profile in Visual Studio. For more information, see dotnet run and .NET Core distribution packaging.

HTTP/2 support

HTTP/2 is supported with ASP.NET Core in the following deployment scenarios:

An HTTP/2 connection must use Application-Layer Protocol Negotiation (ALPN) and TLS 1.2 or later. For more information, see the topics that pertain to your server deployment scenarios.

Additional resources

Ref: Web server implementations in ASP.NET Core