2010-03-18 94 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爲好措施。