I have a new asp.net mvc 3 website with the razor engine and am trying to get the site ready for production where I cannot have the Yellow Screen of Death come up. In webforms this is easy, just turn on customErrors in the web.config and you are done.
To test I setup a test controller method as such:
public ActionResult Ex()
{
throw new InvalidOperationException();
}
I expected the error view (/Views/Shared/Error.cshtml) to be displayed instead I get the Yellow Screen of Death with the message "Operation is not valid due to the current state of the object." I tried turning on customErrors in the web.config and it still does not work. I am calling the RegisterGlobalFilters method in the Global.asax but have also tried applying the HandleError attribute directly.
Thanks for your help.