2010-03-18 95 views
17

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

如果出现任何错误,我总是得到如下错误屏幕:

HTTP错误500.19 - 内部服务器错误
绝对物理路径“C:\inetpub\custerr”是不允许在web.config中system.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> 

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

回答

28

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

  1. 如果您发现有问题的Web.Config文件,您可以删除绝对路径并且应该修复问题。

  2. 一个更容易的解决办法是改变你ApplicationHost.Config文件来设置allowAbsolutePathsWhenDelegated属性true

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

这是不可能upvote你足够。我在我的网站根目录中有一个web.config。从那里删除everythign。 yayayayayayaya !!!!!!!! – Joel 2010-04-08 14:40:27

+0

http://stackoverflow.com/questions/4358339/how-to-prevent-iis7-for-handling-http-status-code-401 – Jared314 2011-01-18 19:43:58

+0

我有iis7.5和vs2013,这个属性是不允许在配置文件,在尝试推进之后,错误仍然出现。 – DanielV 2015-09-15 06:56:36

2

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

1

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

1

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

转到IIS>配置编辑器>在第类型:system.webServer/httpErrors 和设置allowAbsolutePathsWhenDelegated真正。重置IIS为好措施。