From a fresh MVC 3 Project, I've modified an Index() action to throw an exception.  I expect the stock Error.chhtml view to be rendered, because I've set <customErrors mode="On" /> in the web.config.  Instead, I still get the "yellow screen of death" while running from within VS.
<system.web>
  <customErrors mode="On" />
  ...
My HandleError attribute is set globally from the global.asax.cs.
    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new HandleErrorAttribute());
    }
...unmodified, per the default project setup. I've run against both IIS express and VS Dev Server. Nothing causes the custom error page to surface. What am I missing?
I have seen the same problem, which is due to that I added <customErrors mode="On" /> to <root>\Views\Web.config, instead of <root>\Web.config
What web server are you using? IIS7 uses a different section of the web.config...that may be your problem.
See this: What is the difference between customErrors and httpErrors?
Please take a look at this article about MVC 3 Error Display.
Error Handling and CustomErrors and MVC3
 <system.web>
    <customErrors mode="On" defaultRedirect="Error.html">
        <error statusCode="403" redirect="/Error403" />
        <error statusCode="404" redirect="/Error404" />
        <error statusCode="500" redirect="/Error500" />
    </customErrors>
</system.web>
<system.webServer>
  <httpErrors errorMode="Custom" existingResponse="Auto" defaultResponseMode="ExecuteURL" >
    <remove statusCode="403"/>
    <remove statusCode="404"/>
    <remove statusCode="500"/>
    <error statusCode="403" responseMode="ExecuteURL" path="/Error403" />
    <error statusCode="404" responseMode="ExecuteURL" path="/Error404" />
    <error statusCode="500" responseMode="ExecuteURL" path="/Error500" />
  </httpErrors>
</system.webServer>
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论