Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP Error 502.5 - Process Failure in ASP.NET Core 2.1 application

Tags:

asp.net-core

I have just upgraded our ASP.NET Core 2.0 application to 2.1. It builds and deploys fine, but I get the above error when attempting to launch it from our local web server (IIS). I get the same error when launching it from Azure too.

The error logs give me the following error.

Application 'MACHINE/WEBROOT/APPHOST/OSCAR_INTERNAL_HTTPS' with physical root 'C:\OscarWeb_Test' failed to start process with commandline 'dotnet .\OscarWeb.dll', ErrorCode = '0x80004005 : 80008083.

When I launch the application from the command line I get the following error.

enter image description here

It says there is a missing assembly, but it is there in the project, and was there before I upgraded. For some reason it cannot find the assembly since upgrading to ASP.NET Core 2.1

like image 765
DomBurf Avatar asked Jul 12 '18 11:07

DomBurf


People also ask

What is 502. 5 error?

The 502.5 error often indicates some start-up error in your application. It could be the runtime, something your installation, or it could just be a crash in your application. There are a few ways to get more information that can help us diagnose this issue: Try running the app from the command-line using dotnet run.


2 Answers

The solution is to set the property PublishWithAspNetCoreTargetManifest to false. I have set this in the .csproj as follows.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
  </PropertyGroup>

It works for both on-premise (IIS) and Azure deployments.

A fuller explanation of the property is given in this article

like image 181
DomBurf Avatar answered Dec 13 '22 19:12

DomBurf


There are multiple reasons as to why this error may arise. I'll try highlighting two reasons causing this issue for me:

The first answer to the question posted on the link below really helped me. ASP.NET Core 1.0 on IIS error 502.5

  1. Calling your .dll file of your project in the cmd using the dotnet command will help you understand exactly what the issue is. In my case there was a version error for ASP.NET core. Make sure all your project dependencies in the .csproj file of your project use the same version of ASP.NET core SDK and runtime bundle. You can check the versions present on your system through the dotnet command on cmd:

    dotnet --info
    
  2. I also kept getting the HTTP 502.5 error because of an incorrect configuration in my hosts file at C:\Windows\System32\drivers\etc. Make sure the IP and port that your application is listening on is correctly configured in the hosts file.

like image 34
PJay Avatar answered Dec 13 '22 17:12

PJay