Thanks for reading my post.
Originally, I was using ASP.NET MVC on the .NET framework, but I want to migrate to .NET 5.
However, this line of code:
filterContext.Controller.ControllerContext.HttpContext.Server.ScriptTimeout = TimeoutSeconds;
is not working in .NET 5 - how to solve that?
It seems you are trying to set corresponding functionality on asp.net 5 same as previously Server.ScriptTimeout
on asp.net MVC. If that is the scenario you could achieve that using ServertimeOut
in IIS and in Program.cs
you can set as following way:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>()
.UseKestrel(option =>
{
option.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(10);
option.Limits.RequestHeadersTimeout = TimeSpan.FromMinutes(10);
})
.Build();
});
Note: You could refer to official document here for further reference.
You can do that on IIS as well:
For IIS follow these steps to do same thing:
Here is the screenshots for better clarity: