DomBurf
DomBurf

Reputation: 2522

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

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

Upvotes: 7

Views: 36797

Answers (8)

processPath="C:\Program Files (x86)\dotnet\dotnet.exe"

Upvotes: 0

sameer bhokare
sameer bhokare

Reputation: 14

Its all about the SDK versioning and your .net core version If you are using VS 2019 and your project running on older version then you have to install the SDK relating to the project like SDK 2.0 or related to project.

Upvotes: 0

tobbenb3
tobbenb3

Reputation: 665

When running the dotnet command as suggested, I found that I had a BadImageFormatException. My platform target was x86. This fixed it:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

A more general solution: https://github.com/dotnet/sdk/issues/8662

Upvotes: 0

My workaround was this:

Open the web.config file and look for process path. By default it is set to processPath="dotnet".

You have look for the dotnet.exe file and copy and paste the location here in web.config file.

For my case:

processPath="C:\Program Files\dotnet\dotnet.exe"

Upvotes: 3

DomBurf
DomBurf

Reputation: 2522

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

Upvotes: 5

PRATEEK GHOSH
PRATEEK GHOSH

Reputation: 253

I was having the same issue in 2.1 make sure you have same version of .net core run time(x86/x64) and window server hosting of .net core in the environment you are setting the application. Below are the settings required mine is now 2.2 but it will work for 2.1 as well and it has worked for me also.

<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>

enter image description here

enter image description here

Upvotes: 0

muhammad tayyab
muhammad tayyab

Reputation: 812

I had mistakenly removed

  CreateWebHostBuilder(args).Build().Run();

From Program.cs file. After putting it back error was immediately solved

Upvotes: 2

PJay
PJay

Reputation: 2797

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.

Upvotes: 4

Related Questions