ELMAH 未在 MVC3 中显示原始 ASP.NET 错误页面
http://www.matheda.com/Blog/Details/3 /Exception-Logging-with-ELMAH
使用上面的 url 作为参考,我可以看到当错误源自视图时,ELMAH 应该显示原始 ASP.NET 错误页面。
我创建了以下视图来生成错误,但唯一的例外视图是 XML 或 JSON 中的原始/源数据。
@{
ViewBag.Title = "ViewError";
}
<h2>View Error</h2>
@{
throw new NullReferenceException();
}
是否可以在 MVC3 中查看原始 ASP.NET 错误页面?
http://www.matheda.com/Blog/Details/3/Exception-Logging-with-ELMAH
Using the above url as a reference, I can see ELMAH should display the Original ASP.NET error page when the error originates from the View.
I have created the following view to generate an error, but the only exception views are Raw/Source data in XML or in JSON.
@{
ViewBag.Title = "ViewError";
}
<h2>View Error</h2>
@{
throw new NullReferenceException();
}
Is it possible to view the Original ASP.NET error page in MVC3?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MVC3 现在有一个不同的处理错误的过程,绕过 HttpApplication 的错误处理,我不确定 ELMAH 是否可以重新创建此时的黄屏死机。
CodeSmith Insight 与 ELMAH 具有非常相似的功能,我们必须创建一个新的 MVC3 特定 HttpModule 才能继续获取所有我们的异常详细信息。这是一个 博客发布有关我们的实施的文章,希望有所帮助。
MVC3 now has a different process for handling errors that bypasses the HttpApplication's error handling, and I am not sure that ELMAH can recreate the yellow screen of death at that point.
CodeSmith Insight has very similar functionality to ELMAH, and we had to create a new MVC3 specific HttpModule to continue getting all of our exception details. Here is a blog post about our implementation, hope that helps.
如果我没记错的话,ELMAH 将调用 Server.GetLastError(),这意味着在您期望的错误之后是否发生任何错误,您可能会得到一份与您的预期不同的 ELMAH 报告。
我知道当我的 404 页面并不真正存在时,这种情况就发生在我身上...当完全存在不同的错误时,我收到了页面未找到错误的垃圾邮件。
If I Recall Correctly, ELMAH will call Server.GetLastError(), which means if any error happened after the error you're expecting, you might get an ELMAH report that is different than your expectations.
I know this happened to me when my 404 page wasn't really there... I got spammed by page-not-found errors when there was a different error altogether.