visual-studio-2017web-configasp.net-core-2.0iis-expressweb-config-transform

ASP.NET Core 2.0 how to increase IIS Express request timeout in launchSettings.json


I have an ASP.NET Core 2.0 API that I am trying to debug using VS2017 / IIS Express on my local Win10 dev computer and I am running into an issue with IIS Express in that it is hitting the response timeout default of 2 minutes before my process can complete in my API, thus returning a 502.3 - Bad Gateway message.

I process continues to run in my API and completes after 3 minutes and 50 seconds. So, I need to increase the request timeout for IIS Express.

Most of the examples I have found on the web talk about using the web.config, for example;

<?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="dotnet" arguments=".\MyAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>

... but from what I understand, An ASP.NET Core 2.0 API running on the local IIS Express doesn't uses a web.config from my project bt rather, it relies on launchSettings.json in the project. However, I have not been able to find anything on the web that talks about launchSettings having any settings values for increasing default timeouts.

Just to confirm, I tried putting a web.config file, like what I listed above, in my project's wwwroot folder, but it made no difference. This worked on my deployed solution in Azure (see related Stack Overflow post) but doesn't in IIS Express on my local dev.

This seems like it should be a simple task but so far I have not had any luck finding a solution.

Any ideas?

EDIT 5/27/18 - SOLUTION

IIS Express with ASP.NET Core 2.0 uses a file similar to a web.config called applicationhost.config, which is located in the project root/.vs/config folder. This file has a

<configuration><Location> ... <location</configuration> 

section similar to what I have listed below. This section has the

<aspNetCore ... />

node where I was able to apply the requestTimeout value. By setting that, my dev system was able to get past the default 2 minute timeout.

<location path="MyAPI">
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <httpCompression>
      <dynamicCompression>
        <add mimeType="text/event-stream" enabled="false" />
      </dynamicCompression>
    </httpCompression>
    <aspNetCore requestTimeout="00:20:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="false" />
  </system.webServer>
</location>

Solution

  • You misunderstood the concepts.

    launchSettings.json is only used by Visual Studio to determine how to run your web project. (More info in my blog post)

    IIS Express still relies on web.config to read the settings, as that's the only file it understands.