How to troubleshoot "HTTP Error 502.5 - Process Failure" with .net core

Programming, error messages and sample code > ASP.NET

Common causes of 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 Ways:

Way1: Enable logging the application process’ stdout messages in web.config
 
  1. create folder "logs" under your site root folder if it does not exist
  2. open the root web.config file of your site, set stdoutLogEnabled to true
    • ​​​(you will not need to edit other property of any tag in the web.config)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Test.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>
 
you will want to adjust the log level in the appsettings.{environment.}json file in order to capture all log info.
"Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  }
 
 
 
Way2: enable development mode in web.config
 
  • Please note: after you switch to development mode, your application will read configurations from appsettings.development.json file instead of appsettings.json file.
e.g.
<configuration>
  <system.webServer>
    <aspNetCore .....>
      <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
      </environmentVariables>
    </aspNetCore>
  </system.webServer>
</configuration>