Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn IIS7 HTTP Error Handling Off?

I just got setup on my first Windows Server 2008 / IIS7.5 server for a contest I am participating in. I can't for the life of me figure out how to turn OFF error handling COMPLETELY. The only options I see are:

  • Custom
  • Detailed
  • Detailed Local, custom for remote

I want to turn the feature off completely, and I don't see any way to do that. Am I missing something?

My Situation:

I have a RESTful PHP framework that catches exceptions and emits an HTTP 500 status if the exception has not already been handled. It then puts the specified exception message in the response body and sends it to the browser. This works fine in Apache - the correct headers are sent and the message is displayed to the user. In IIS, however, the response for 4xx and 5xx HTTP status codes is always intercepted and injected with some other prepared message or HTML file, and that's exactly what I don't want it to do anymore. Please help!

like image 636
Vance Lucas Avatar asked Feb 26 '10 23:02

Vance Lucas


People also ask

How do I turn off custom error mode?

Choose the ASP.NET tab. Click on "Edit Configuration". Click the Custom Errors tab. Select Off for custom error mode.

How do I enable detailed error messages in IIS 7?

To Enable detailed IIS Error messages:Open Internet Information Services (IIS) Manager. Select "Error Pages" Select "Edit Feature Settings" Select "Detailed Errors"


1 Answers

After some more extensive searching, I found the answer here:

http://blogs.msdn.com/webdevelopertips/archive/2009/08/24/tip-93-did-you-know-php-and-custom-error-pages-configuration.aspx

The solution is to manually edit your web.config file with this custom "httpErrors" entry:

<?xml version="1.0" encoding="UTF-8"?> <configuration>     <system.webServer>         <httpErrors existingResponse="PassThrough" />     </system.webServer> </configuration> 

However, due to IIS 7.0 "lockdown" feature you might get a "This configuration section cannot be used at this path. This happens when the section is locked at a parent level." error. To solve that, execute the following in the command prompt:

cd C:\Windows\System32\inetsrv  appcmd unlock config /section:httpErrors 
like image 129
Vance Lucas Avatar answered Oct 02 '22 20:10

Vance Lucas