ELMAH not displaying Original ASP.NET error page in MVC3
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/Sourc开发者_JAVA技巧e 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?
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.
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.
精彩评论