Skip to content

Kestrel

Kestrel is a web server developed by Microsoft and the engine that runs ASP.NET applications. As it is maintained by Microsoft, this engine is a good choice when you have high performance and security requirements.

using GenHTTP.Engine.Kestrel;

await Host.Create()
          .Handler(...)
          .RunAsync();

If needed, you can pass custom hooks to the host builder to adjust the underlying WebApplication:

using GenHTTP.Engine.Kestrel;

using Microsoft.AspNetCore.Builder;

var configHook = (WebApplicationBuilder b) => { 
    // adjust the builder here
};

var appHook = (WebApplication a) => { 
    // adjust your app here
};

await Host.Create(configHook, appHook)
          .Handler(...)
          .RunAsync();

In contrast to the internal engine, Kestrel supports HTTP/2 and HTTP/3 via SSL/TLS. While HTTP/2 is enabled by default on such endpoints, you need to opt-in to HTTP/3, as the protocol is served via UDP/QUIC which probably requires additional firewall rules on your system:

.Bind(IPAddress.Any, 443, myCertificate, enableQuic: true)