Reputation: 3014
Our mvc application sets the response status code to 401 and sets TrySkipIisCustomErrors to true under some circumstances.
I can see from the IIS log that it is getting this status code:
2012-05-04 01:32:42 10.212.98.183 POST /v1.07/session - 80 - 10.24.22.26 curl/7.20.1+(i686-pc-cygwin)+libcurl/7.20.1+OpenSSL/0.9.8r+zlib/1.2.5+libidn/1.18+libssh2/1.2.5 401 0 0 48325
However the response I receive in the client is 500:
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/html
< Server: Microsoft-IIS/7.0
< Date: Fri, 04 May 2012 02:31:18 GMT
< Content-Length: 75
<
* Connection #0 to host webserver left intact
* Closing connection #0
The page cannot be displayed because an internal server error has occurred.
I have tried various other settings in the web.config for the mvc application around httpErrors and customErrors, none of which seem to make a difference.
How can I configure IIS to return the actual response and not 500?
Upvotes: 1
Views: 2020
Reputation: 3014
So after a lot more googling, I changed the applicationHost.config file to allow delegation of httpErrors and now I get the correct response back to the client.
I had to set the following from Deny to Allow:
<section name="httpErrors" overrideModeDefault="Allow" />
I tried to follow the instructions in the file to use a <location>
tag:
<location path="" overrideMode="Allow">
<system.webServer>
<httpErrors />
</system.webServer>
</location>
but this did not work. It would work if I specified the web site in the path, rather than all sites though, however, I want to allow it for all the sites on the web server.
Upvotes: 2