如何获取部署在 Azure 网站上的 ASP.NET 5 应用程序的错误详细信息? [英] How to Get Error Details of an ASP.NET 5 app deployed on Azure Websites?

查看:22
本文介绍了如何获取部署在 Azure 网站上的 ASP.NET 5 应用程序的错误详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有网站和几个项目库的 ASP.NET 5 解决方案.我正在使用 MVC 6 和 Entity Framework 7.该应用程序在本地运行良好,直到今天它还在作为 Azure 网站部署的 Azure 上运行.

I have an ASP.NET 5 solution with a website and several project libraries. I'm using MVC 6 and Entity Framework 7. Locally the app is working fine and until today it was working also on Azure deployed as an Azure Website.

但是今天在 Azure 上进行最新部署后,我在启动时收到了这样的错误 500(在本地仍然可以正常工作):

But today after the latest deployment on Azure I got an error 500 like this on the startup (still working fine locally):

我试图通过以下方式获取更多详细信息:

I tried to get more details by :

  • 使用中间件诊断
  • 在 web.config 文件中添加 customError/httpError 设置
  • 下载生成的DetailedError页面

似乎在启动/配置步骤期间发生了错误/异常,但我仍然收到没有详细信息的通用错误页面.即使是在服务器上生成的版本(DetailedErrors 文件夹)我也得到了这个:

It seems that the error/exception is happening during the Startup/Configure step but I'm still getting the generic error page without details. Even the version generated on the server (DetailedErrors folder) I got this:

我启用了失败的请求跟踪,但仍然没有有用的信息:

I enabled the Failed Request Tracing but still no useful information:

即使我在 Startup/Configure 中删除代码并按照建议添加 try/catch,我也会得到相同的错误,但没有详细信息.这似乎是一个配置/编译问题,但在没有任何信息的情况下很难调试.

Even if I strip down the code in the Startup/Configure and add a try/catch as suggested I got the same error without détails. It seems to be a configuration/compilation issue but hard to debug without any information.

推荐答案

在 RC1(可能是 beta8)中,显然应该使用:

In RC1 (as of beta8, perhaps), one should apparently use:

app.UseDeveloperExceptionPage();

.. 这显然只有在 app.Properties["host.AppMode"]"development" 时才有效.

.. which apparently only works if app.Properties["host.AppMode"] is "development".

但这对我不起作用.我收到的错误消息是启动应用程序时发生错误",我发现没有一个给定的配置可以解决这个问题,因为错误是在配置执行之前发生的.

But this didn't work for me. The error message I was getting was specifically "An error occurred while starting the application", I have found that none of the given configurations will resolve this because the error is occurring before the configurations execute.

不知何故,发布目标文件夹一定是在发布过程中损坏了,因为我发现删除整个部署目录并重新发布解决了问题.

Somehow, the publish target folder must have gotten corrupted during publish because I found that deleting the entire deployment directory and re-publishing resolved the problem.

否则,这里是参考:http://docs.asp.net/en/latest/fundamentals/diagnostics.htmlhttps://docs.microsoft.com/en-us/aspnet/core/fundamentals/错误处理

这篇关于如何获取部署在 Azure 网站上的 ASP.NET 5 应用程序的错误详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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