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).
However the same code on the production IIS, error pages are substituted.
The problem is described here.
I just wonder is there a way to write this settings in web.config file instead of modifying the code.
To Enable detailed IIS Error messages:Open Internet Information Services (IIS) Manager. Select "Error Pages" Select "Edit Feature Settings" Select "Detailed Errors"
You can add custom error messages to IIS by adding an <error> element to the <httpErrors> element in the Web. config file for your site, application, or URL.
To display a custom error page with an appropriate error code, use the <httpErrors> section only, and do not use the <customErrors> section. Add the following <httpErrors> section under <system. webServer> section, as shown below.
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With