设置:Windows 7、IIS7。我正在开发一个通过本地 IIS 服务器查看的应用程序,而不是内置的调试 Web 服务器。所以我的应用程序网址是 http://localhost/foo/bar.aspx. 。有 <customErrors> 我的 web.config 部分,并且我没有更改 IIS 中的任何设置。

如果发生任何错误,我总是会看到以下错误屏幕:

HTTP 错误 500.19 - 内部服务器错误
绝对物理路径》C:\inetpub\custerr“ 不允许进入 system.webServer/httpErrors web.config 文件中的部分。请改用相对路径。

这是我的 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>

如何消除此配置错误以便可以看到详细的错误?

有帮助吗?

解决方案

过去几天我一直在处理这个问题并找到了解决方案。Web.Config 文件可能指定错误页面之一的绝对路径。这可能不是您正在测试的应用程序的 Web.Config。对我来说,它是网站的 Web.Config 文件。

  1. 如果您发现有问题的 Web.Config 文件,您可以删除绝对路径,问题应该会得到解决。

  2. 一个更简单的解决方案是改变你的 应用程序主机配置 文件来设置 allowAbsolutePathsWhenDelegated 财产给 true:

    <httpErrors allowAbsolutePathsWhenDelegated="true" errorMode="Custom" 
                lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
    

其他提示

我有同样的问题,当我安装Active Directory证书服务的域控制器上。他们都使用443端口。我改变了服务器的IP地址的一个证书服务,离开了交换服务器分配。这解决了我的问题。

我在IIS 8.5有同样的问题。此修复程序是删除web.config文件(位于网站的根目录)中引用的自定义错误页的任何条目。该项目是由我曾试图修改自定义页面的系统创建。

什么帮助我解决这个错误是设置allowAbsolutePathsWhenDelegated为true。

节型

转到 IIS>配置编辑器>:system.webServer / httpErrors 和设置allowAbsolutePathsWhenDelegated即可。复位的 IIS 作为良好的措施。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top