.net-core-2.0 azure应用程序服务502.5错误 [英] .net-core-2.0 azure app service 502.5 error

查看:129
本文介绍了.net-core-2.0 azure应用程序服务502.5错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CI部署到天蓝色的应用程序服务后收到502.5错误。

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

运行 dotnet {myproject} .dll 在调试控制台上,这是我得到的错误:

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


未处理的异常:System.IO.FileLoadException:无法加载文件或程序集' System.Diagnostics.DiagnosticSource,版本= 4.0.2.1,区域性=中性,PublicKeyToken = CC7b13ffcd2ddd51'。找到的程序集的清单定义与程序集引用不匹配。 (来自HRESULT的异常:0x80131040)Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& amp; HostingStartupErrors)中的
Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()中的
My.IOEducation D:\home\site\Repository\My.IOEducation.Api\Program.cs:line 11中的.Api.Program.Main(String [] args)

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

运行 dotnet --version 返回 2.0.0

还有其他人遇到这个问题,以及有关如何解决的任何建议吗?

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

更新:
这是

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


推荐答案

发现了问题。让我首先添加更多信息。这最初是一个.net-core-1.1项目,我按照Microsoft提供的说明将其更新为2.0。升级后,我在本地运行完全没有问题,但是一旦尝试发布我的azure应用程序服务,我就不断收到IIS错误。最后的努力是今天早上从头开始创建一个新的.net-core-2.0项目,并注意到新项目文件包含以下内容:

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>

我将其添加到现有项目文件(从1.1升级的文件)中,现在错误消失了并解决了问题。

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

这篇关于.net-core-2.0 azure应用程序服务502.5错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆