Enable yellow death screen on MVC 3

I had to take on the MVC 3 project from another developer. One of the first things he did was to stop the yellow screen of death so that all exceptions were written only to a file. Now you get only a general message that an error has occurred.

I would like to turn it on again (since it is still very boring to check the log files all the time) - how to do it.

I checked through web.config, but I do not see where this is happening.

I tried to make customerrors = off, but it did nothing. Also removed the global error handling attribute, did nothing.

Upon further refinement, it seems that an exception is thrown in the controller, I get a yellow death screen, but if it appears in the (razor) view, I get a standard general error.

Here you can see web.config here. You can see global.asax here.

+4
source share
4 answers

In Global.asax you can remove filters.Add(new HandleErrorAttribute()); from public static void RegisterGlobalFilters(GlobalFilterCollection filters) .

As noted in the comments, the problem was that the Custom Base controller overrides the OnException method.

+2
source

You usually set this in the web.config file in the customErrors element in the system.web section. Just try setting mode = Off:

 <customErrors mode="Off" /> 
+4
source

This question is a little old, but maybe this will help someone. In addition to setting <customerErrors mode="Off" /> also set this value to <system.webServer> : <httpErrors errorMode="Detailed" />

 <system.webServer> <httpErrors errorMode="Detailed"/> </system.webServer> 
+4
source

None of this worked for me. Check to see if anyone has added code to fix the error in the application error event handler.

  protected void Application_Error(object sender, EventArgs e) { Exception lastException = Server.GetLastError().GetBaseException(); Log.Error("Global.asax: WebApplication error", lastException); //****Server.ClearError(); } 
0
source

Source: https://habr.com/ru/post/1339018/


All Articles