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

5

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 commandline 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

asp.net-core
asked on Stack Overflow Jul 12, 2018 by DomBurf

6 Answers

3

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.

answered on Stack Overflow Aug 29, 2018 by PJay
3

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

answered on Stack Overflow Jul 22, 2019 by DomBurf • edited Jul 1, 2020 by Leo
2

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"
answered on Stack Overflow Aug 20, 2020 by Md.Mehfil Rashid Khan Samio • edited Aug 20, 2020 by Ralf
1

I had mistakenly removed

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

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

answered on Stack Overflow Nov 23, 2019 by muhammad tayyab
0

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

answered on Stack Overflow Nov 30, 2019 by PRATEEK GHOSH
0

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

answered on Stack Overflow Feb 8, 2021 by tobbenb3

User contributions licensed under CC BY-SA 3.0