受欢迎的博客标签

Configure options for the ASP.NET Core Kestrel web server

Published

 

.Net 5.x

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/options?view=aspnetcore-5.0

http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_requests

using Microsoft.AspNetCore.Server.Kestrel.Core;

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.ConfigureKestrel(serverOptions =>
            {
                // Set properties and call methods on options
                serverOptions.Limits.KeepAliveTimeout =         TimeSpan.FromMinutes(2);
                serverOptions.Limits.RequestHeadersTimeout =         TimeSpan.FromMinutes(1);
            })
            .UseStartup<Startup>();
        });

Kestrel 源码及缺省参数详解

https://codingnote.cc/zh-tw/p/98633?share=pocket/

 

Microsoft-AspNetCore-Server-Kestrel" counters

https://docs.microsoft.com/en-us/dotnet/core/diagnostics/available-counters