I\'m running an application that has its own error handlers. Error pages are displayed properly while testing in dev environment (error pages are displayed properly).
Howe
I found out that the <system.webServer>
section can let the request pass through. Then, my app can display my custom page. You can use these lines in your Web.Config
:
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
You can also read the extended version to know What to expect from IIS7 custom error module.
Well It turned out that in order to force IIS 7 to show custom pages the following lines should be added to web.config file.
Put in system.webServer section
<httpErrors errorMode="Detailed"> <!-- this is impornant -->
<!-- Some custom error pages url go here -->
</httpErrors>
There is a setting in the applications Web.config file to set the debug mode:
Default is:
<customErrors mode="RemoteOnly" />
Try setting it to "Off" (Note: the value is case sensitive!)
<customErrors mode="Off" />
I'm not sure if this setting is respected by IIS7, but since you see different behaviour on your development environment from the deployed, this was my fist guess. To test if this is the case, you can try to run your dev app from a different machine in your network if you have that possibility.
Awe is right (+1), but in addition: IIS 7 has special handling described in the blog post you linked and this MSDN article. If you are using HandleErrorAttribute on your action, this is already done for you. If not, you'll need to set:
filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
...yourself.