ASP.NET Core 2.1 application ignoring request timeout defined in web configuration

1k Views Asked by At

I need to set request timeout on .net core application (version 2.1) hosted on iis. I set "requesttimeout" in web configuration file, but it is ignored. I tried settings on iis but without any luck. Is there a way to solve this problem? I found information that "requesttimeout" is ignored for inProcess model in .net core version 3, but not in 2.1.

1

There are 1 best solutions below

9
Jalpa Panchal On

Based on the Microsoft document you can set the timeout value to the .net core 2.1 or later but it will not work with in-process hosting. For in-process hosting, the module waits for the app to process the request.

you could refer to this below link:

https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.1

you can set the value as suggested below:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <system.webServer>
  <handlers>
   <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" 
              forwardWindowsAuthToken="false"/>
 </system.webServer>
</configuration>