问题描述
设置:Windows 7,IIS7。我正在开发一个通过本地IIS服务器查看的应用程序,而不是内置的调试Web服务器。所以我的应用网址是 http://localhost/foo/bar.aspx
。我的web.config中有否 < customErrors>
部分,我没有更改IIS中的任何设置。
Setup: Windows 7, IIS7. I am working on an app that is being viewed through the local IIS server, not the built in debugging web server. So my app url is http://localhost/foo/bar.aspx
. There is no <customErrors>
section in my web.config, and I haven't changed any settings in IIS.
如果发生任何错误,我总会收到以下错误屏幕:
If any error occurs, I always get the following error screen:
这是我的 applicationhost.config
内容:
<httpErrors errorMode="Custom" lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
<error statusCode="401" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="401.htm" />
<error statusCode="403" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="403.htm" />
<error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="404.htm" />
<error statusCode="405" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="405.htm" />
<error statusCode="406" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="406.htm" />
<error statusCode="412" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="412.htm" />
<error statusCode="500" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="500.htm" />
<error statusCode="501" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="501.htm" />
<error statusCode="502" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="502.htm" />
</httpErrors>
如何摆脱此配置错误,以便查看详细错误?
How can I get rid of this configuration error so I can see detailed errors?
推荐答案
过去几天我一直在处理这个问题,并找到了解决方案。 Web.Config文件可能指定其中一个错误页面的绝对路径。这可能不是您正在测试的应用程序的Web.Config。对我来说,这是该网站的Web.Config文件。
I've been dealing with this issue for the last few days and found the solution. A Web.Config file is likely specifying an absolute path for one of the error pages. This may not be the Web.Config of the application you are testing. For me, it was the website's Web.Config file.
-
如果您发现有问题的Web.Config文件,您可以删除绝对路径和问题应该修复。
If you find the offending Web.Config file you can remove the absolute path and the problem should be fixed.
更简单的解决方案是改变你的文件设置 allowAbsolutePathsWhenDelegated
属性为 true
:
A much easier solution would be to alter your ApplicationHost.Config file to set the allowAbsolutePathsWhenDelegated
property to true
:
<httpErrors allowAbsolutePathsWhenDelegated="true" errorMode="Custom"
lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
这篇关于发生错误时IIS7中出现500.19错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!