Azure-未处理的异常:System.IO.FileNotFoundException [英] Azure - Unhandled Exception: System.IO.FileNotFoundException
问题描述
我在这里有一个情况.我将发布我的测试" .net核心应用程序(.net core 3.1)之一,以查看Azure platfrom的工作原理,并且发布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"?<配置><位置路径=".InheritInChildApplications =假"< system.webServer><处理程序>< add name ="aspNetCore";path ="*"动词="*"modules ="AspNetCoreModuleV2";resourceType =未指定"/></handlers>< aspNetCore processPath ="dotnet";arguments =".\ SportsStore.dll"stdoutLogEnabled ="false";stdoutLogFile =""\\?\%home%\ LogFiles \ stdout"HostingModel =处理中"/></system.webServer></位置><运行时>< assemblyBinding xmlns =< urn:schemas-microsoft-com:asm.v1">< dependentAssembly>< assemblyIdentity name =" System.Net.Http"publicKeyToken ="b03f5f7f11d50a3a"文化=中立"/>< bindingRedirect oldVersion ="0.0.0.0-4.2.0.0";newVersion ="4.0.0.0"/></dependentAssembly></assemblyBinding></runtime></configuration>
我找到了很多有关此问题的主题,但对我而言却无济于事.有任何建议吗?
根据您的描述,我认为此 500
错误应该是部署失败错误.
答案的最后,有一个建议的解决方案,建议尝试.
为了快速找到并解决问题,我建议使用
如果上述方法不能帮助您找到故障的具体原因,那么建议您使用诊断并解决问题
进行故障排除.在搜索框中搜索收集.NET Profiler跟踪
,
然后,您可以单击收集配置文件跟踪
,然后等待系统生成报告.点击链接,您将打开一个新页面,并查看有关该Web应用程序的更多详细信息.
建议一个试验计划(特定问题需要特定解决方案)
- 尝试修改
web.config
文件.
< customErrors defaultRedirect =" YourErrorPage.aspx"模式=关".<错误statusCode ="500";redirect ="InternalErrorPage.aspx"/>
您还可以在您的代码中创建登录,然后您可以查看更多详细信息.
- 如果确定程序没有问题,建议重新创建一个新的
资源组
或选择另一个region
尝试重新部署.如果仍然发生此错误,建议在门户中提出支持票
.
总结:
-
首先,建议使用git进行连续部署以对操作环境或发布操作中出现的问题进行故障排除.
-
使用工具排除根本原因,如果确实不可能,则可以提出支持的请求.
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%\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>
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)
- 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.
- When you are sure that there is no problem with your program, it is recommended to re-create a new
resource group
or choose anotherregion
to try to redeploy. If this error still occurs, it is recommended toraise a support ticket
in the portal.
Sum up:
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.
Use tools to troubleshoot the root cause, if it is really impossible, you can raise a ticket for support.
这篇关于Azure-未处理的异常:System.IO.FileNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!