HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

Problem

I got the following error when I deployed my ASP.NET Core Razor page application to the production server after updating some NuGet packages to the latest version.

HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

Common solutions to this issue:

  • The application process failed to start
  • The application process started but then stopped
  • The application process started but failed to listen on the configured port

Troubleshooting steps:

  • Check the system event log for error messages
  • Enable logging the application process' stdout messages
  • Attach a debugger to the application process and inspect

For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681

Solution

The error message itself gives troubleshooting steps. As I don't have access to the server, I cannot check the event log. So I chose the 2nd option. . i.e., Enable logging the application process' stdout messages.

This can be done as follows.

 Open the web.config file of your production application. 

Inside the <system.webServer> tag add the following line if it is not already there. If it is already there, just make sure that "stdoutLogEnabled" is set to true. 

 <aspNetCore processPath="dotnet" arguments=".\yourapplication.dll" 
stdoutLogEnabled="true" stdoutLogFile=".\logs\stdoutlog" hostingModel="OutOfProcess" />

Here, “Yourapplication.dll” Should be replaced with the assembly name of your application. Path to the log file also can be replaced with a path you prefer. When you run the application after making these changes, you will get details of the error in the log file. 

You can see the error details in the log file specified in the above markup as the value of the "stdoutLogFile" attribute. 

In my case, HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure error was due to the absence of the updated NuGet packages in the production server. Once all the local server files were updated to the production server, the problem was solved for me.


Search