7
votes

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

6

6 Answers

5
votes

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

3
votes

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.

2
votes

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"
1
votes

I had mistakenly removed

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

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

0
votes

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

0
votes

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