.net-core-2.0 azure app service 502.5 error

22

Getting a 502.5 error after CI deployment to azure app service.

When running dotnet {myproject}.dll on the debug console this is the error I get:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors) at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at My.IOEducation.Api.Program.Main(String[] args) in D:\home\site\repository\My.IOEducation.Api\Program.cs:line 11

Running dotnet --version returns 2.0.0

Anyone else run into this yet and any suggestions on how to resolve?

UPDATE: Here is the contents of the project file.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="Models\Report\" />
    <Folder Include="wwwroot\" />
    <Folder Include="DataAccess\ExternalApis\" />
    <Folder Include="DataAccess\ExternalApis\Helpers\" />
    <Folder Include="Models\Dashboard\" />
    <Folder Include="Helpers\" />
    <Folder Include="DataAccess\Redis\" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
    <PackageReference Include="PowerBI.NetStandard.Api" Version="1.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUi" Version="1.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="1.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="1.0.0" />
    <PackageReference Include="Dapper" Version="1.50.2" />
    <PackageReference Include="StackExchange.Redis" Version="1.2.6" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
  </ItemGroup>
  <ItemGroup>
    <None Remove="DataAccess\.DS_Store" />
    <None Remove=".DS_Store" />
  </ItemGroup>
</Project>
c#
.net
azure
asp.net-core-2.0
.net-core-2.0
asked on Stack Overflow Aug 15, 2017 by ktice12 • edited Aug 15, 2017 by ktice12

3 Answers

23

I spoke to the aspnet IISIntegration team members and found my solution.

tldr: Empty out your wwwroot folder on kudu.

The issue relates to having old things leftover from previous 1.x deployments

Step 1:

Navigate to the Kudu Console (https://{yourapp}.scm.azurewebsites.net/)

Step 2:

Navigate to file structure

Step 3:

Delete wwwroot folder

(Note: navigate into the "site" directory)

(Note: there is a wwwroot folder within this wwwroot. You should delete the one that is in the "site" directory)

Step 4:

Add a new empty folder called wwwroot where you just deleted the previous one (within "site" directory)

(Note: my deployment failed when I didn't have the empty wwwroot folder in there)

Step 5: Redeploy your app and hopefully it works. Good luck

answered on Stack Overflow Aug 16, 2017 by Charl • edited Aug 17, 2017 by Charl
16

Found the issue. Let me start by adding a little more information. This was originally a .net-core-1.1 project that I updated to 2.0 following instructions provided by Microsoft. After upgrading, I had no issues at all running locally, but once I tried to publish my azure app service, i kept getting the IIS error. Last ditch effort was to create a new .net-core-2.0 project from scratch this morning and noticed that the new project file contained this:

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>

I added that to my existing project file (the one upgraded from 1.1) and now the error is gone and issue resolved.

answered on Stack Overflow Aug 15, 2017 by ktice12 • edited Aug 15, 2017 by ktice12
1

Brand new .net core 2.1 app trying to deploy to new Azure app service with new app service plan. Same issues, namely 502.5 error ( HTTP Error 502.5 - Process Failure ).

I implemented the above steps and still ran into errors. I opted to use the chose the self-contained deployment mode (compared to framework dependent (win-x64)).

This resolved my issue.

This answer was also submitted to [question]: ASP.NET Core 2.0 Preview 2 on IIS error 502.5

Perhaps these questions should be linked.

answered on Stack Overflow Jun 27, 2018 by daviesdoesit

User contributions licensed under CC BY-SA 3.0