19

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

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

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

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

我怎样才能摆脱这个配置错误,以便我可以看到详细的错误?

4

5 回答 5

40

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

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

  2. 一个更简单的解决方案是更改您的ApplicationHost.Config文件以将allowAbsolutePathsWhenDelegated属性设置为true

    <httpErrors allowAbsolutePathsWhenDelegated="true" errorMode="Custom" 
                lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
    
于 2010-04-02T15:47:59.643 回答
2

我在域控制器上安装 Active Directory 证书服务时遇到了同样的问题。他们都使用端口 443。我将用于证书服务的端口更改为服务器 IP 地址,并未分配交换服务器。这解决了我的问题。

于 2011-02-14T20:46:24.643 回答
1

我在 IIS 8.5 中遇到了同样的问题。修复方法是删除 web.config 文件(位于网站的根目录中)中引用自定义错误页面的所有条目。当我尝试更改自定义页面时,系统会创建这些条目。

于 2015-04-21T20:34:17.460 回答
1

帮助我解决此错误的是设置allowAbsolutePathsWhenDelegated为 true。

转到IIS > 配置编辑器 > 在 Section type: system.webServer/httpErrors 并设置allowAbsolutePathsWhenDelegatedtrue。重置IIS以获得良好的衡量标准。

于 2016-02-02T15:44:18.287 回答
0

对我来说,解决方案是在右窗格中设置自定义帐户选择应用程序-->基本设置-->连接为-->提供用户名和密码,然后授予该用户对 inetpub>wwwroot>文件夹名上项目文件夹的完全权限

于 2021-09-20T13:15:29.277 回答