ASP.NET Core deployed on IIS returns 502 Error for long running requests

By default, ASP.NET Core request time out is 2 minutes, and you can change it via requestTimeout in setting file. See more here

requestTimeout Optional timespan attribute.

Specifies the duration for which the ASP.NET Core Module will wait for a response from the process listening on %ASPNETCORE_PORT%.

The default value is "00:02:00".

The requestTimeout must be specified in whole minutes only, otherwise it defaults to 2 minutes.


I am getting same error when data is huge and take more time to execute web page, I have changed timeout value for .netcore in web.config

<?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>

I have add requestTimeout="00:20:00" in my existing web.config file and it works.

for reference go to this url