Back to Aspnetcore

Kestrel web server in ASP.NET Core

aspnetcore/fundamentals/servers/kestrel.md

latest3.5 KB
Original Source

Kestrel web server in ASP.NET Core

[!INCLUDE]

By Tom Dykstra, Chris Ross, and Stephen Halter

:::moniker range=">= aspnetcore-10.0"

Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is the recommended server for ASP.NET Core, and it's configured by default in ASP.NET Core project templates.

Kestrel's features include:

  • Cross-platform: Kestrel is a cross-platform web server that runs on Windows, Linux, and macOS.
  • High performance: Kestrel is optimized to handle a large number of concurrent connections efficiently.
  • Lightweight: Optimized for running in resource-constrained environments, such as containers and edge devices.
  • Security hardened: Kestrel supports HTTPS and is hardened against web server vulnerabilities.
  • Wide protocol support: Kestrel supports common web protocols, including:
  • Integration with ASP.NET Core: Seamless integration with other ASP.NET Core components, such as the middleware pipeline, dependency injection, and configuration system.
  • Flexible workloads: Kestrel supports many workloads:
    • ASP.NET app frameworks such as Minimal APIs, MVC, Razor pages, SignalR, Blazor, and gRPC.
    • Building a reverse proxy with YARP.
  • Extensibility: Customize Kestrel through configuration, middleware, and custom transports.
  • Performance diagnostics: Kestrel provides built-in performance diagnostics features, such as logging and metrics.
  • Memory management: Kestrel includes features for efficient memory management. For more information, see xref:fundamentals/servers/kestrel/memory-management.

Get started

ASP.NET Core project templates use Kestrel by default when not hosted with IIS. In the following template-generated Program.cs, the xref:Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder%2A?displayProperty=nameWithType method calls xref:Microsoft.AspNetCore.Hosting.WebHostBuilderKestrelExtensions.UseKestrel%2A internally:

:::code language="csharp" source="~/fundamentals/servers/kestrel/samples/6.x/KestrelSample/Program.cs" id="snippet_CreateBuilder" highlight="1":::

For more information on configuring WebApplication and WebApplicationBuilder, see xref:fundamentals/minimal-apis.

Additional resources

<a name="endpoint-configuration"></a>

:::moniker-end

[!INCLUDE]