How to fix IIS HTTP Error 502.5 in ASP.NET Core? Print

  • 0

You may encounter the below error while deploying an ASP.NET Core application in IIS. 

HTTP Error 502.5 - Process Failure

It may come if you have manually modified your web.config file of core application. There are 2 different solutions to this issue. 

  • Install the .NET Core Runtime

One of the common reasons for this issue is not installing the .net core runtime. Download the latest .net core runtime from here. You can download the required x64 or x86 bit .net core version for your application.

  • Modify your Web.config file

Make sure you are taking the backup of your web.config file before proceeding for this step. 

Web.config file of ASP.Net Core application contains a handler that directs requests to the AspNetCoreModule and aspNetCore that define and configure the ASP.NET Core process to execute your application. Below is the file for the ASP.NET core application.

<?xml version="1.0" encoding="utf-8"?>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" 
        stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>

The Cause

If your web.config file is untransformed, it may contain the variables %LAUNCHER_PATH% and %LAUNCHER_ARGS% and not the correct paths. When IIS runs ASP.NET Core, it uses %LAUNCHER_PATH% and %LAUNCHER_ARGS% and not the correct path and arguments.

The Fix 

In order to fix the HTTP Error 502.5 in ASP.NET Core, you can transform the web.config and replace the untransformed web.config file on the IIS web server.

<aspNetCore processPath="dotnet" arguments=".\MyApplication.dll" stdoutLogEnabled="true" 
    stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />

%LAUNCHER_PATH% will be modified by dotnet and %LAUNCHER_ARGS% will be modified with the main web application dll .\MywebApplication.dll.

Was this answer helpful?

« Back