Azure - 未处理的异常:System.IO.FileNotFoundException [英] Azure - Unhandled Exception: System.IO.FileNotFoundException

查看:27
本文介绍了Azure - 未处理的异常:System.IO.FileNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这里有一个情况.我会发布我的一个测试".net 核心应用程序(.net 核心 3.1)以查看 Azure 平台如何工作,并且在发布 Web 应用程序运行后出现问题然后我有一个错误:目前无法处理这个请求 HTTP 错误 500".采取的行动:

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

  • 我试图更改 web.config 但错误是相同的

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

<配置><位置路径=."inheritInChildApplications="false"><system.webServer><处理程序><添加名称=aspNetCore"路径=*"动词=*"模块=AspNetCoreModuleV2";资源类型=未指定";/></处理程序><aspNetCore processPath="dotnet";参数=.SportsStore.dll"stdoutLogEnabled=假"stdoutLogFile=\?\%home%LogFilesstdout"托管模型=处理中"/></system.webServer></位置><运行时><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><从属程序集><assemblyIdentity name="System.Net.Http";publicKeyToken=b03f5f7f11d50a3a"文化=中性"/><bindingRedirect oldVersion=0.0.0.0-4.2.0.0";newVersion=4.0.0.0";/></dependentAssembly></assemblyBinding></运行时></配置>

我找到了很多关于这个问题的话题,但对我来说没有帮助.有什么建议吗?

解决方案

从你的描述来看,我认为这个500错误应该是部署失败错误.

在答案的最后,有一个建议的解决方案可以尝试,推荐尝试.

为了快速定位和解决问题,推荐使用

如果上述方法不能帮助您定位故障的具体原因,那么我建议您使用诊断和解决问题来排查问题.在搜索框中搜索 Collect .NET Profiler Trace,

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

建议试用方案(具体问题需要具体解决方案)

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

<错误状态代码=500"重定向=InternalErrorPage.aspx"/>

您也可以在您的代码中创建登录,然后您可以看到更多详细信息.

  1. 当你确定你的程序没有问题时,建议重新创建一个新的资源组或者选择另一个region尝试重新部署.如果此错误仍然发生,建议在门户中提出支持票.

总结:

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

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

i have a situation here. I would to publish one of my 'test' .net core application (.net core 3.1) to see how Azure platfrom works and there is a problem after publishing web app is running then i have an error: "currently unable to handle this request HTTP ERROR 500". Actions taken:

  • I've run .dll in Kudu console error description : "Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."

  • I was trying to change web.config but error is the same

(web.config after edit):

<?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%LogFilesstdout" 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>

I found a lot of topics about this issue but it wasn't help in my case. Any sugesstions ?

解决方案

From your description, I think this 500 error should be a deployment failure error.

At the end of the answer, there is a suggested solution to try, it is recommended to try.

In order to quickly locate and solve the problem, I recommend using git for continuous deployment. More error logs can be viewed in Action like pic.

If the above method does not help you locate the specific cause of the failure, then I suggest you use Diagnose and solve problems to troubleshoot the problem. Search the search box for Collect .NET Profiler Trace,

Then you can click Collect Profile Trace, and wait system generate a report. Click the link, you will open a new page and see more details about the webapp.

Suggest a trial plan (specific problems need specific solutions)

  1. Try by modifying the web.config file.

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

You also can create log in your code, then you can see more details.

  1. When you are sure that there is no problem with your program, it is recommended to re-create a new resource group or choose another region to try to redeploy. If this error still occurs, it is recommended to raise a support ticket in the portal.

Sum up:

  1. First of all, it is recommended to use git for continuous deployment to troubleshoot the operating environment or problems that occur in the release operation.

  2. Use tools to troubleshoot the root cause, if it is really impossible, you can raise a ticket for support.

这篇关于Azure - 未处理的异常:System.IO.FileNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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