Skip to content

Commit 0d158db

Browse files
committed
Add KestrelServerOptions
1 parent 3c7a472 commit 0d158db

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

src/Tests/WebApplicationTest/Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ public static class Program
99

1010
private static void Main(string[] args)
1111
{
12+
Console.WriteLine(TimeSpan.MaxValue);//10675199.02:48:05.4775807
13+
Console.WriteLine(Timeout.InfiniteTimeSpan);//-00:00:00.0010000
14+
1215
var builder = WebApplication.CreateBuilder(args);
1316

1417
// Add services to the container.
@@ -35,7 +38,8 @@ private static void Main(string[] args)
3538
.ConfigureKestrel(
3639
serverOptions =>
3740
{
38-
serverOptions.Limits.MaxResponseBufferSize = 10; // Disable response buffering limit
41+
serverOptions.ConfigurationLoader?.Configuration.GetSection("Limits").Bind(serverOptions.Limits);
42+
//serverOptions.Limits.MaxResponseBufferSize = null; // Disable response buffering limit
3943
});
4044

4145
var app = builder.Build();

src/Tests/WebApplicationTest/appsettings.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
11
{
2+
"Kestrel": {
3+
"Limits": {
4+
"MaxRequestLineSize": 8192, //8 KB
5+
"RequestHeadersTimeout": "00:00:30",
6+
"MaxRequestHeaderCount": 100,
7+
"MaxRequestHeadersTotalSize": 32768, //32 KB
8+
"MaxRequestBodySize": 30000000, //28.6 MB
9+
"MaxRequestBufferSize": 1048576, //1 M
10+
"MaxResponseBufferSize": 65536, //64 KB
11+
"MinRequestBodyDataRate": {
12+
"BytesPerSecond": 240,
13+
"GracePeriod": "00:00:05"
14+
},
15+
"MinResponseDataRate": {
16+
"BytesPerSecond": 240,
17+
"GracePeriod": "00:00:05"
18+
},
19+
"KeepAliveTimeout": "00:02:10",
20+
"MaxConcurrentConnections": null,
21+
"MaxConcurrentUpgradedConnections": null,
22+
"Http2": {
23+
"HeaderTableSize": 4096,
24+
"InitialConnectionWindowSize": 1048576,
25+
"InitialStreamWindowSize": 786432,
26+
"KeepAlivePingDelay": "10675199.02:48:05.4775807", //Timespan.MaxValue or -00:00:00.0010000
27+
"KeepAlivePingTimeout": "00:00:20",
28+
"MaxFrameSize": 16384,
29+
"MaxRequestHeaderFieldSize": 32768,
30+
"MaxStreamsPerConnection": 100
31+
},
32+
"Http3": {
33+
"MaxRequestHeaderFieldSize": 32768
34+
}
35+
}
36+
},
237
"Logging": {
338
"LogLevel": {
439
"Default": "Information",

0 commit comments

Comments
 (0)