HTTP Hosting Limits Configuration
Configure the Kestrel hosting limits of the PowerTSM HTTP API web service.
These limits control various aspects of HTTP request and response handling, connection management, and protocol-specific settings for HTTP/2 and HTTP/3.
Configuration Path
Section titled “Configuration Path”HAKOM:TSM:Http:Hosting:LimitsConfiguration Structure
Section titled “Configuration Structure”As of .NET 8, the following options are available:
Limits├─ KeepAliveTimeout├─ MaxConcurrentConnections├─ MaxConcurrentUpgradedConnections├─ MaxRequestBodySize├─ MaxRequestBufferSize├─ MaxRequestHeaderCount├─ MaxRequestHeadersTotalSize├─ MaxRequestLineSize├─ MaxResponseBufferSize├─ MinRequestBodyDataRate│ ├─ BytesPerSecond│ └─ GracePeriod├─ MinResponseDataRate│ ├─ BytesPerSecond│ └─ GracePeriod├─ RequestHeadersTimeout├─ Http2│ ├─ MaxStreamsPerConnection│ ├─ HeaderTableSize│ ├─ MaxFrameSize│ ├─ MaxRequestHeaderFieldSize│ ├─ InitialConnectionWindowSize│ ├─ InitialStreamWindowSize│ ├─ KeepAlivePingDelay│ └─ KeepAlivePingTimeout└─ Http3 ├─ MaxRequestHeaderFieldSectionSize ├─ HeaderTableSize └─ MaxRequestHeaderFieldSizeQuick Start
Section titled “Quick Start”Limit concurrent connections to 1000 and set keep-alive timeout to 5 minutes:
<HAKOM> <TSM> <Http> <Hosting> <Limits> <KeepAliveTimeout>00:05:00</KeepAliveTimeout> <MaxConcurrentConnections>1000</MaxConcurrentConnections> <MaxConcurrentUpgradedConnections>100</MaxConcurrentUpgradedConnections> </Limits> </Hosting> </Http> </TSM></HAKOM>Configuration Elements
Section titled “Configuration Elements”General Connection Limits
Section titled “General Connection Limits”| Element | Type | Default | Required | Description |
|---|---|---|---|---|
KeepAliveTimeout |
TimeSpan |
00:02:00 |
The maximum time to keep a connection alive between requests. Specified in the format hh:mm:ss. |
|
MaxConcurrentConnections |
long |
— | The maximum number of concurrent HTTP connections. Set to null for unlimited. Unlimited by default. |
|
MaxConcurrentUpgradedConnections |
long |
— | The maximum number of concurrent upgraded connections (e.g., WebSockets). Set to null for unlimited. Unlimited by default. |
Request and Response Size Limits
Section titled “Request and Response Size Limits”| Element | Type | Default | Required | Description |
|---|---|---|---|---|
MaxRequestBodySize |
long |
30000000 |
The maximum allowed size of any request body in bytes (≈ 28.6 MB). Set to null for unlimited. |
|
MaxRequestBufferSize |
long |
1048576 |
The maximum size of the request buffer in bytes (1 MB). Set to null to use default. |
|
MaxResponseBufferSize |
long |
65536 |
The maximum size of the response buffer in bytes (64 KB). Set to null to use default. |
Set the maximum request body size to 100 MB in HAKOM:TSM:Http:Hosting:Limits:
<Limits> <MaxRequestBodySize>104857600</MaxRequestBodySize> <MaxRequestBufferSize>2097152</MaxRequestBufferSize> <MaxResponseBufferSize>131072</MaxResponseBufferSize></Limits>Request Header Limits
Section titled “Request Header Limits”| Element | Type | Default | Required | Description |
|---|---|---|---|---|
MaxRequestHeaderCount |
int |
100 |
The maximum number of headers allowed in a request. | |
MaxRequestHeadersTotalSize |
int |
32768 |
The maximum total size of all request headers in bytes (32 KB). | |
MaxRequestLineSize |
int |
8192 |
The maximum size of the request line (method, URL, and HTTP version) in bytes (8 KB). | |
RequestHeadersTimeout |
TimeSpan |
00:00:30 |
The maximum time to receive request headers. Specified in the format hh:mm:ss. |
Increase the header limits in HAKOM:TSM:Http:Hosting:Limits for applications with large headers:
<Limits> <MaxRequestHeaderCount>200</MaxRequestHeaderCount> <MaxRequestHeadersTotalSize>65536</MaxRequestHeadersTotalSize> <MaxRequestLineSize>16384</MaxRequestLineSize> <RequestHeadersTimeout>00:01:00</RequestHeadersTimeout></Limits>Data Rate Limits
Section titled “Data Rate Limits”Configure minimum data transfer rates to prevent slow connection attacks. See minimum request body data rate for the underlying Kestrel behavior.
MinRequestBodyDataRate
Section titled “MinRequestBodyDataRate”Controls the minimum rate at which request body data must be received.
Path: HAKOM:TSM:Http:Hosting:Limits:MinRequestBodyDataRate
| Element | Type | Default | Required | Description |
|---|---|---|---|---|
BytesPerSecond |
double |
240 |
The minimum required data rate in bytes per second. Set to null to disable rate limiting. |
|
GracePeriod |
TimeSpan |
00:00:05 |
The time period during which the minimum rate is not enforced. Specified in the format hh:mm:ss. |
MinResponseDataRate
Section titled “MinResponseDataRate”Controls the minimum rate at which response data must be sent.
Path: HAKOM:TSM:Http:Hosting:Limits:MinResponseDataRate
| Element | Type | Default | Required | Description |
|---|---|---|---|---|
BytesPerSecond |
double |
240 |
The minimum required data rate in bytes per second. Set to null to disable rate limiting. |
|
GracePeriod |
TimeSpan |
00:00:05 |
The time period during which the minimum rate is not enforced. Specified in the format hh:mm:ss. |
Configure data rate limits
Section titled “ Configure data rate limits”Set minimum data rates for request and response in HAKOM:TSM:Http:Hosting:Limits:
<Limits> <MinRequestBodyDataRate> <BytesPerSecond>1024</BytesPerSecond> <GracePeriod>00:00:10</GracePeriod> </MinRequestBodyDataRate> <MinResponseDataRate> <BytesPerSecond>512</BytesPerSecond> <GracePeriod>00:00:10</GracePeriod> </MinResponseDataRate></Limits>Disable data rate limiting
Section titled “ Disable data rate limiting”To disable data rate limiting in HAKOM:TSM:Http:Hosting:Limits (not recommended for production):
<Limits> <MinRequestBodyDataRate> <BytesPerSecond></BytesPerSecond> </MinRequestBodyDataRate> <MinResponseDataRate> <BytesPerSecond></BytesPerSecond> </MinResponseDataRate></Limits>HTTP/2 Limits
Section titled “HTTP/2 Limits”See HTTP/2 Limits.
HTTP/3 Limits
Section titled “HTTP/3 Limits”See HTTP/3 Limits.
Examples
Section titled “Examples”Complete configuration
Section titled “ Complete configuration”A comprehensive example combining multiple limit settings in HAKOM:TSM:Http:Hosting:Limits:
<Limits> <!-- Connection Settings --> <KeepAliveTimeout>00:05:00</KeepAliveTimeout> <MaxConcurrentConnections>1000</MaxConcurrentConnections> <MaxConcurrentUpgradedConnections>100</MaxConcurrentUpgradedConnections>
<!-- Size Limits --> <MaxRequestBodySize>52428800</MaxRequestBodySize> <MaxRequestBufferSize>2097152</MaxRequestBufferSize> <MaxResponseBufferSize>131072</MaxResponseBufferSize>
<!-- Header Limits --> <MaxRequestHeaderCount>150</MaxRequestHeaderCount> <MaxRequestHeadersTotalSize>65536</MaxRequestHeadersTotalSize> <MaxRequestLineSize>16384</MaxRequestLineSize> <RequestHeadersTimeout>00:01:00</RequestHeadersTimeout>
<!-- Data Rate Limits --> <MinRequestBodyDataRate> <BytesPerSecond>1024</BytesPerSecond> <GracePeriod>00:00:10</GracePeriod> </MinRequestBodyDataRate> <MinResponseDataRate> <BytesPerSecond>512</BytesPerSecond> <GracePeriod>00:00:10</GracePeriod> </MinResponseDataRate>
<!-- HTTP/2 Settings --> <Http2> <MaxStreamsPerConnection>200</MaxStreamsPerConnection> <HeaderTableSize>8192</HeaderTableSize> <MaxFrameSize>32768</MaxFrameSize> <MaxRequestHeaderFieldSize>16384</MaxRequestHeaderFieldSize> <InitialConnectionWindowSize>262144</InitialConnectionWindowSize> <InitialStreamWindowSize>196608</InitialStreamWindowSize> <KeepAlivePingDelay>00:01:00</KeepAlivePingDelay> <KeepAlivePingTimeout>00:00:30</KeepAlivePingTimeout> </Http2>
<!-- HTTP/3 Settings --> <Http3> <MaxRequestHeaderFieldSectionSize>16384</MaxRequestHeaderFieldSectionSize> <HeaderTableSize>8192</HeaderTableSize> <MaxRequestHeaderFieldSize>16384</MaxRequestHeaderFieldSize> </Http3></Limits>