简体   繁体   中英

Disabling Nagle algorithm in Kestrel Web Server with ASP.NET Core 3.0

ListenOptions.NoDelay is removed and not available in .NET Core 3.0 anymore. In the documentation for migrating to 3.0 ( https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio#transport-abstractions-moved-and-made-public ) it says:

NoDelay was moved from ListenOptions to the transport options.

But it doesn't show how this change shall be implemented.

How can I set the NoDelay option to false in .NET Core 3.0? Thanks!

Add a package reference to

<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="3.0.0" />

and invoke:

Host.CreateDefaultBuilder(args)
    .ConfigureWebHostDefaults(webBuilder =>
    {
        webBuilder
            .UseLibuv(opts =>{
                opts.NoDelay = false;
            })
            .UseStartup<Startup>();
    });

See official docs on Transport configuration

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM