Overview

ASP.NET on Windows ships with:

  • Kestrel
  • IIS HTTP Server (an in-process server for IIS)
  • HTTP.sys

On IIS/Express:

  • IIS HTTP Server—runs in same process as IIS worker process
  • Kestrel—runs in separate process as IIS worker process

Documentation: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/?view=aspnetcore-7.0&tabs=windows

Kestrel vs HTTP.sys

ServerPerformanceCross-platformPort and TLS configurationAlternate transportsPort SharingAuthenticationFast proxyingDirect file transmissionResponse caching
KestrelBetterYesYesYesNouser-modeNoNoNo
HTTP.sysPoorerNoNoNoYeskernel-modeYesYesYes

Kestrel

Use Kestrel unless a feature that only HTTP.sys provides is required.

Use Cases

Edge server

Edge server

Reverse proxy

Reverse proxy

HTTP/2 Support

Both Kestrel and HTTP.sys require Windows 10/Server 2016 or later. On Linux, Kestrel requires OpenSSL 1.0.2.

HTTP/3 Support

ℹ️ Important

Availability: ASP.NET Core 7

These notes on HTTP/3 apply.

HTTP/3 is not enabled by default. To enable:
Program.cs

var builder = WebApplication.CreateBuilder(args);

builder.WebHost.ConfigureKestrel((context, options) =>
{
    options.ListenAnyIP(5001, listenOptions =>
    {
        // HTTP/3 should be configured with HTTP/1.1 and HTTP/2:
        listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
        // HTTP/3 requires HTTPS:
        listenOptions.UseHttps();
    });
});

HTTP/3 is discovered as an available upgrade via the alt-svc header. Kestrel automatically adds this header when HTTP/3 is enabled.

Testing HTTP/3 with Localhost

Browsers do not allow self-signed certificates on HTTP/3 (like the Kestrel development certificate). To use HttpClient for localhost testing, follow the instructions in these notes on HTTP/3 for configuring HttpClient.