Set request timeout for specific controller ASP.Net Core MVC

Viewed 1744

I am trying to increase the request timeout for a specific controller in a .Net core application, but the only way I can find to do it is increasing the requestTimeout globally in the web.config by doing this.

  <system.webServer>
    <handlers>
      <remove name="aspNetCore"/>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore requestTimeout="00:20:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>

In ASP 4 it was possible to specify the timeout programmatically in a controller/action, but I haven't found this inside .Net Core.

HttpContext.Current.Server.ScriptTimeout = 1200;

My question is, is there a way to set the timeout programmatically inside an action / controller in ASP.NET core?

1 Answers

No, there is no way to set the timeout programmatically in specific controller or action.

Related