Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
203 views
in Technique[技术] by (71.8m points)

c# - .net-core-2.0 azure app service 502.5 error

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:homesite epositoryMy.IOEducation.ApiProgram.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="ModelsReport" />
    <Folder Include="wwwroot" />
    <Folder Include="DataAccessExternalApis" />
    <Folder Include="DataAccessExternalApisHelpers" />
    <Folder Include="ModelsDashboard" />
    <Folder Include="Helpers" />
    <Folder Include="DataAccessRedis" />
  </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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...