Timeouts with long running ASP.NET MVC Core Controller HTTPPost Method

But in .Net Core 2.0 there is no web.config file in project. It generate automatically.

I solved the problem by adding .UseKestrel(...) to the BuildWebHost function in Program.cs file as follows:

public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseStartup<Startup>()
        .UseKestrel(o => { o.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(10); })
        .Build();
}

… Update for .net Core 6 …

in Program.cs file after

var builder = WebApplication.CreateBuilder(args);

add ConfigureKestrel for WebHost like this

builder.WebHost.ConfigureKestrel(c =>
{
   c.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(15);
});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)