Add Kestrel keep alive ping section (#20261)
parent
d94bb6df40
commit
47ac274813
|
@ -340,6 +340,30 @@ webBuilder.ConfigureKestrel(serverOptions =>
|
|||
|
||||
The default value is 96 KB (98,304).
|
||||
|
||||
::: moniker range=">= aspnetcore-5.0"
|
||||
|
||||
### HTTP/2 keep alive ping configuration
|
||||
|
||||
Kestrel can be configured to send HTTP/2 pings to connected clients. HTTP/2 pings serve multiple purposes:
|
||||
|
||||
* Keep idle connections alive. Some clients and proxy servers close connections that are idle. HTTP/2 pings are considered as activity on a connection and prevent the connection from being closed as idle.
|
||||
* Close unhealthy connections. Connections where the client doesn't respond to the keep alive ping in the configured time are closed by the server.
|
||||
|
||||
There are two configuration options related to HTTP/2 keep alive pings:
|
||||
|
||||
* `Http2.KeepAlivePingInterval` is a `TimeSpan` that configures the ping internal. The server sends a keep alive ping to the client if it doesn't receive any frames for this period of time. Keep alive pings are disabled when this option is set to `TimeSpan.MaxValue`. The default value is `TimeSpan.MaxValue`.
|
||||
* `Http2.KeepAlivePingTimeout` is a `TimeSpan` that configures the ping timeout. If the server doesn't receive any frames, such as a response ping, during this timeout then the connection is closed. Keep alive timeout is disabled when this option is set to `TimeSpan.MaxValue`. The default value is 20 seconds.
|
||||
|
||||
```csharp
|
||||
webBuilder.ConfigureKestrel(serverOptions =>
|
||||
{
|
||||
serverOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(30);
|
||||
serverOptions.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(60);
|
||||
});
|
||||
```
|
||||
|
||||
::: moniker-end
|
||||
|
||||
### Trailers
|
||||
|
||||
[!INCLUDE[](~/includes/trailers.md)]
|
||||
|
|
Loading…
Reference in New Issue