我们的mvc应用程序将响应状态代码设置为401,并在某些情况下将TrySkipIisCustomErrors设置为true。
我可以从IIS日志中看到它正在获取此状态代码:
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
但是我在客户端收到的回复是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.
我已经在web.config中尝试了围绕httpErrors和customErrors的mvc应用程序的各种其他设置,但这些设置似乎没什么区别。
如何配置IIS以返回实际响应而不是500?
答案 0 :(得分:2)
所以经过更多的谷歌搜索后,我更改了applicationHost.config文件以允许委派httpErrors,现在我得到了正确的响应回到客户端。
我必须将以下内容从Deny设置为Allow:
<section name="httpErrors" overrideModeDefault="Allow" />
我尝试按照文件中的说明使用<location>
标记:
<location path="" overrideMode="Allow">
<system.webServer>
<httpErrors />
</system.webServer>
</location>
但这不起作用。如果我在路径中指定了网站,而不是所有网站,它会工作,但是,我想允许它用于Web服务器上的所有网站。