Search code examples
iistimeoutstartup

How do you configure the process startup timeout in IIS?


I'm running benchmarks on an IIS server to see how it scales. I have an expensive start up process (reading in a lot of data from SQL, populating an AI network), but with 4 or more processors, it usually finishes in a few minutes. I'm currently trying to start the web service with 2 processors and I keep getting this message:

Application '/LM/W3SVC/1/ROOT' with physical root 'C:\inetpub\wwwroot\' failed to load coreclr. Exception message: Managed server didn't initialize after 120000 ms.

After some searching, I find this is related to the IIS property: startupTimeLimit. So I go into IIS, find the application pool and change the value:

IIS AppPool settings

But this didn't change the outcome. Also, I'm suspicious because the default value of the AppPool setting was 90 seconds and the documentation of startupTimeLimit says the default is 120 seconds, which corresponds to the error message.

How do I tell IIS not to shut down a long running initialization process?


Solution

  • In your web.config file, locate the section aspNetCore, you can set the timeout limit here, using the following property: startupTimeLimit

    <aspNetCore processPath="dotnet" startupTimeLimit="340" hostingModel="inprocess" >
    

    The default=120, max=3600 and min=0

    Taken from the documentation:

    Optional integer attribute.

    Duration in seconds that the module waits for the executable to start a process listening on the port. If this time limit is exceeded, the module kills the process.

    When hosting in-process: The process is not restarted and does not use the rapidFailsPerMinute setting.

    When hosting out-of-process: The module attempts to relaunch the process when it receives a new request and continues to attempt to restart the process on subsequent incoming requests unless the app fails to start rapidFailsPerMinute number of times in the last rolling minute.

    A value of 0 (zero) is not considered an infinite timeout.