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

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 asp.net 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"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" 
        stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
  </system.webServer>
</configuration>

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.

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to Enable mod_rewrite on IIS Web Server?

Microsoft URL Rewrite module offers you similar functionality like Apache mod_rewrite module. It...

How to Install Python on Windows server?

Python is a high-level language and in high-demand nowadays. Following are the steps to install...

How to redirect website from HTTP to https in IIS?

If we install the SSL Certificate on a website, it is required to redirect the website from HTTP...

Do You Provide Crystal Report in Windows Hosting Plans?

Windows Shared Hosting In Windows Shared Hosting, we only provide SAP Crystal Reports runtime...

Why do my email receipients receive (?????) question marks when I send emails using Arabic text?

Sometimes, emails sent through the SmarterMail containing Arabic texts, show the question marks...