.net-core-2.0 azure app service 502.5 error

Viewed 7147

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>
3 Answers

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.

Related