“抱歉,处理您的请求时出错”的直接原因和来源是什么?信息? [英] What is the direct cause and source of the "Sorry, an error occurred while processing your request." message?

查看:332
本文介绍了“抱歉,处理您的请求时出错”的直接原因和来源是什么?信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多查询关于ASP.Net MVC错误对不起,处理您的请求时出错。不幸的是,我没有找到任何真正讨论真正发生的事情。可以理解,他们专注于潜在的错误,而不是消息的直接来源和原因。因此,这些解决方案给同样的问题提供了广泛不同的答案。



以下是一些示例:





根据我研究的许多答案中的堆栈跟踪数据,似乎可能会在 System.Web.Mvc.ControllerActionInvoke 类。一般来说,这是执行ActionResult方法中的一个未处理的错误的直接结果。



我想了解在消息中处理您的请求一词。根据我看到错误显示的方式,这似乎不太可能是指HTTP请求。也许在MVC架构中更细腻?有人可以在这个消息发起的地方有更多的光明吗?

解决方案

开箱即用的默认错误处理ASP.Net MVC应用程序将错误重定向到Error.aspx共享视图。您将在Error.aspx文件中找到对不起,处理您的请求时发生错误消息文本。消息不是从.Net类生成的。



以下SO问题带给我了解:
ASP.NET MVC HandleError不起作用(customErrors设置为On)



要查看有关基本错误的更多详细信息,您有几个选项。




  • 自定义默认的Error.aspx页面以显示底层错误的详细信息。


  • 关闭web.config文件中的CustomErrors。未来的错误应显示默认的ASP.Net黄色屏幕错误详细信息,而不是抱歉,发生错误消息。


  • 具体处理错误相关联的ActionResult方法。



There are many inquiries out there about the ASP.Net MVC error "Sorry, an error occurred while processing your request". Unfortunately, I was not able to find any that actually discuss what is really occurring. Understandably they focus on the underlying error rather than the immediate source and cause of the message. Consequently these solutions give widely varying answers to the same question.

Here are a few examples:

Based on the stack trace data in many of the answers I researched it appears that this may be triggered in the System.Web.Mvc.ControllerActionInvoke class. It seems in general to be a direct result of an unhandled error in the executing ActionResult method.

I'd like to understand the term "processing your request" in the message. Based on the way I've seen the error display, it seems unlikely that this is referring to the HTTP Request. Perhaps something more granular in the MVC architecture? Can someone shed some more light on where this message originates and why?

解决方案

The default error handling of an out-of-box ASP.Net MVC Application redirects errors to the Error.aspx shared view. You will find the "Sorry, an error occurred while processing your request" message text inside the Error.aspx file. The message is not generated from a .Net class.

The following SO question brought me to the light: ASP.NET MVC HandleError not working (customErrors is set to "On")

To see more details about the underlying error you have a few options.

  • Customize the default Error.aspx page to display details about the underlying error.

  • Turn off the CustomErrors in the web.config file. Future errors should display the default ASP.Net "yellow screen" error details instead of the "Sorry, an error occurred message".

  • Handle the error specifically in the associated ActionResult method.

这篇关于“抱歉,处理您的请求时出错”的直接原因和来源是什么?信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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