Gavin Draper's Blog

Father, Developer, Tech Geek, Extreme Sports Fanatic

@gavdraper | +gavdraper | github | StackOverflow Careers
 

ASP.Net MVC Debugging "Internal Server Error 500"

I was recently seeing “Internal Server Error 500” when trying to make an ajax call from an ASP.Net MVC view back to the controller. No breakpoints or errors were being thrown in the application.

I ended up getting the error information by adding the following event to my Global.asax.cs

protected void Application_EndRequest()  
{
}

You can then put a break point on the first curly brace and put a watch on “this.Context.AllErrors” allowing you to F5 over each request until you come to one that has an error in the AllErrors property. In my case it was a Json deserialization error which gave me all the information I needed to fix the problem.


 
comments powered by Disqus