|
1 | | -:::moniker range=">= aspnetcore-6.0 <=aspnetcore-9.0" |
| 1 | +:::moniker range=">= aspnetcore-8.0 <= aspnetcore-9.0" |
| 2 | + |
| 3 | +Kestrel is a cross-platform [web server for ASP.NET Core](xref:fundamentals/servers/index). Kestrel is the recommended server for ASP.NET Core, and it's configured by default in ASP.NET Core project templates. |
| 4 | + |
| 5 | +Kestrel's features include: |
| 6 | + |
| 7 | +* **Cross-platform:** Kestrel is a cross-platform web server that runs on Windows, Linux, and macOS. |
| 8 | +* **High performance:** Kestrel is optimized to handle a large number of concurrent connections efficiently. |
| 9 | +* **Lightweight:** Optimized for running in resource-constrained environments, such as containers and edge devices. |
| 10 | +* **Security hardened:** Kestrel supports HTTPS and is hardened against web server vulnerabilities. |
| 11 | +* **Wide protocol support:** Kestrel supports common web protocols, including: |
| 12 | + * HTTP/1.1, [HTTP/2](xref:fundamentals/servers/kestrel/http2) and [HTTP/3](xref:fundamentals/servers/kestrel/http3) |
| 13 | + * [WebSockets](xref:fundamentals/websockets) |
| 14 | +* **Integration with ASP.NET Core:** Seamless integration with other ASP.NET Core components, such as the middleware pipeline, dependency injection, and configuration system. |
| 15 | +* **Flexible workloads**: Kestrel supports many workloads: |
| 16 | + * ASP.NET app frameworks such as Minimal APIs, MVC, Razor pages, SignalR, Blazor, and gRPC. |
| 17 | + * Building a reverse proxy with [YARP](https://github.com/microsoft/reverse-proxy). |
| 18 | +* **Extensibility:** Customize Kestrel through configuration, middleware, and custom transports. |
| 19 | +* **Performance diagnostics:** Kestrel provides built-in performance diagnostics features, such as logging and metrics. |
| 20 | + |
| 21 | +## Get started |
| 22 | + |
| 23 | +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: |
| 24 | + |
| 25 | +:::code language="csharp" source="~/fundamentals/servers/kestrel/samples/6.x/KestrelSample/Program.cs" id="snippet_CreateBuilder" highlight="1"::: |
| 26 | + |
| 27 | +For more information on configuring `WebApplication` and `WebApplicationBuilder`, see <xref:fundamentals/minimal-apis>. |
| 28 | + |
| 29 | +## Behavior with debugger attached |
| 30 | + |
| 31 | +The following timeouts and rate limits aren't enforced when a debugger is attached to a Kestrel process: |
| 32 | + |
| 33 | +* <xref:Microsoft.AspNetCore.Server.Kestrel.KestrelServerLimits.KeepAliveTimeout?displayProperty=nameWithType> |
| 34 | +* <xref:Microsoft.AspNetCore.Server.Kestrel.KestrelServerLimits.RequestHeadersTimeout?displayProperty=nameWithType> |
| 35 | +* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerLimits.MinRequestBodyDataRate?displayProperty=nameWithType> |
| 36 | +* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerLimits.MinResponseDataRate?displayProperty=nameWithType> |
| 37 | +* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.Features.IConnectionTimeoutFeature> |
| 38 | +* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.Features.IHttpMinRequestBodyDataRateFeature> |
| 39 | +* <xref:Microsoft.AspNetCore.Server.Kestrel.Core.Features.IHttpMinResponseDataRateFeature> |
| 40 | + |
| 41 | +## Additional resources |
| 42 | + |
| 43 | +<a name="endpoint-configuration"></a> |
| 44 | +* <xref:fundamentals/servers/kestrel/endpoints> |
| 45 | +<a name="kestrel-options"></a> |
| 46 | +* <xref:fundamentals/servers/kestrel/options> |
| 47 | +<a name="http2-support"></a> |
| 48 | +* <xref:fundamentals/servers/kestrel/http2> |
| 49 | +<a name="when-to-use-kestrel-with-a-reverse-proxy"></a> |
| 50 | +* <xref:fundamentals/servers/kestrel/when-to-use-a-reverse-proxy> |
| 51 | +<a name="host-filtering"></a> |
| 52 | +* <xref:fundamentals/servers/kestrel/host-filtering> |
| 53 | +* <xref:test/troubleshoot> |
| 54 | +* <xref:security/enforcing-ssl> |
| 55 | +* <xref:host-and-deploy/proxy-load-balancer> |
| 56 | +* [RFC 9110: HTTP Semantics (Section 7.2: Host and :authority)](https://www.rfc-editor.org/rfc/rfc9110#field.host) |
| 57 | +* When using UNIX sockets on Linux, the socket isn't automatically deleted on app shutdown. For more information, see [this GitHub issue](https://github.com/dotnet/aspnetcore/issues/14134). |
| 58 | + |
| 59 | +:::moniker-end |
| 60 | + |
| 61 | +:::moniker range=">= aspnetcore-6.0 < aspnetcore-8.0" |
2 | 62 |
|
3 | 63 | Kestrel is a cross-platform [web server for ASP.NET Core](xref:fundamentals/servers/index). Kestrel is the web server that's included and enabled by default in ASP.NET Core project templates. |
4 | 64 |
|
|
0 commit comments