【问题标题】:Azure - Unhandled Exception: System.IO.FileNotFoundExceptionAzure - 未处理的异常:System.IO.FileNotFoundException
【发布时间】:2020-11-13 03:29:21
【问题描述】:

我这里有个情况。我将发布我的“测试”.net 核心应用程序之一(.net 核心 3.1)以查看 Azure 平台的工作原理,并且在发布 Web 应用程序运行后出现问题,然后出现错误:“当前无法处理此请求HTTP 错误 500”。 采取的措施:

  • 我在 Kudu 控制台错误描述中运行 .dll:“未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集‘System.Runtime,版本=4.2.2.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a’或其依赖项之一。系统找不到指定的文件。"

  • 我试图更改 web.config 但错误是一样的

(编辑后的 ​​web.config):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\SportsStore.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
   <runtime>  
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
        <dependentAssembly>
            <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
        </dependentAssembly>
      </assemblyBinding>  
   </runtime> 
</configuration>

我发现了很多关于这个问题的主题,但对我来说没有帮助。有什么建议吗?

【问题讨论】:

  • 您使用什么流程发布?
  • 我已经通过 VS 发布了一个应用程序 -> 发布 -> 应用程序服务 -> 根据 Adam Freeman 的书“Asp.net core mvc 2”创建新的(配置文件)。但我不确定我是否正确理解了你的问题,因为我是 Azure 的新手。
  • 你的程序在本地能正常运行吗?建议尝试使用git进行部署。

标签: c# .net-core web-config azure-web-app-service kudu


【解决方案1】:

根据你的描述,我认为这个500错误应该是部署失败错误。

答案最后有建议的解决方案可以尝试,建议尝试。

为了快速定位和解决问题,我推荐git为continuous deployment。更多错误日志可以在 Action like pic 中查看。

如果以上方法不能帮助您定位到具体的故障原因,那么建议您使用Diagnose and solve problems排查问题。在搜索框中搜索Collect .NET Profiler Trace,

然后您可以点击Collect Profile Trace,等待系统生成报告。单击该链接,您将打开一个新页面并查看有关该 webapp 的更多详细信息。

提出试用计划(具体问题需要具体解决方案)

  1. 尝试修改web.config文件。

<customErrors defaultRedirect="YourErrorPage.aspx" mode="Off">
<error statusCode="500" redirect="InternalErrorPage.aspx"/>

你也可以create log in your code,然后你可以看到更多的细节。

  1. 当你确定你的程序没有问题时,建议重新创建一个新的resource group或者选择另一个region尝试重新部署。如果还是出现这个错误,建议在门户中raise a support ticket。

总结一下:

  1. 首先推荐使用git进行持续部署,排查运行环境或发布操作中出现的问题。

  2. 使用工具来解决根本原因,如果确实不可能,您可以提出支持请求。

【讨论】:

  • 感谢您的回复。我已经使用了您的解决方案,现在应用程序可以正常运行。我已经通过 git 推送了项目,这有帮助。很抱歉我迟到的回复:)!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-03
  • 1970-01-01
  • 2016-09-08
  • 2017-10-31
相关资源
最近更新 更多