H
HridayDutta
Introduction
ASP.NET Core applications hosted in IIS are designed to provide robust performance. However, sometimes issues arise that prevent apps from starting properly within the expected time. One common problem is the HTTP Error 500.37, which indicates that the application failed to start within the startup time limit. This article will walk you through what causes this error and how to resolve it.
Problem
HTTP Error 500.37 occurs when an ASP.NET Core application hosted in IIS does not start within the allocated startup time. The default time limit is 120 seconds. This may happen due to various reasons such limited resource (CPU and memory), long initialization tasks, or inadequate startup time configurations in IIS. The error message usually looks like this -
This issue can be particularly problematic for larger or resource-intensive applications, where a longer startup time might be required to complete initialization tasks.
Solution
The good news is that this issue is easily fixable by increasing the startup time limit for the application in the web.config file. Here's a step-by-step guide to applying the fix:
Locate your application's web.config file, which should be in the root directory of your ASP.NET Core application. And update the startupTimeLimit to a higher value then default 120 seconds in <aspNetCore> section.
<aspNetCore processPath="dotnet" arguments=".\YourApp.dll" stdoutLogEnabled="false" startupTimeLimit="360" />
In this example, the startupTimeLimit is set to 360 seconds (6 minutes). You can adjust this value based on the needs of your application. This configuration gives your application a longer window to initialize properly, preventing the 500.37 error from occurring.
Although, this fix will resolve the issue and allow the application to run smoothly, it's important to review the Startup.cs or Program.cs files to identify if any modules or dependencies are taking longer than expected to initialize. You can also grab a worker process dump or a profiler trace to find out where the time is being spent.
Conclusion
HTTP Error 500.37 indicate startup failure of your ASP.NET Core application in IIS that requires more time to initialize. By adjusting the startupTimeLimit in the web.config file, you can give your application the necessary time to start and avoid startup errors. This simple yet effective solution ensures your application runs smoothly, even under complex startup conditions.
Continue reading...