Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

IIS 7.0/7.5/8.x 常見錯誤代碼速查:404.11 雙重逸出、404.13 內容長度、500.19 設定檔、503 服務不可用

編輯:系統常見問題解答

IIS 7+ 模組化管線引入詳細子狀態碼,快速定位問題:

1. HTTP 404.11 - URL_DOUBLE_ESCAPED

訊息:「要求篩選模組被設定為拒絕包含雙重逸出序列的要求。」
原因:URL 含 %25 (雙重編碼 %)、%2F (斜線)、%5C (反斜線) 等。
解決:applicationHost.config → <requestFiltering allowDoubleEscaping="true" /> (僅信任內部應用)。
更佳:應用程式層面正規化 URL,避免雙重編碼。

2. HTTP 404.13 - CONTENT_LENGTH_TOO_LARGE

訊息:「要求篩選模組被設定為拒絕超過要求內容長度的要求。」
預設限制:maxAllowedContentLength="30000000" (約 30 MB)。
解決:applicationHost.config 或 web.config:
<requestFiltering><requestLimits maxAllowedContentLength="104857600" /></requestFiltering> (100 MB)。
注意:ASP.NET 另需 <httpRuntime maxRequestLength="102400" /> (單位 KB) 同步調整。

3. HTTP 500.19 - CONFIG_ERROR

訊息:「無法讀取組態資料...」
常見 HRESULT:
• 0x8007000d:XML 格式錯誤 (標籤未閉合、特殊字元未逸出)。
• 0x80070005:權限不足 (IIS_IUSRS 讀取 web.config 失敗)。
• 0x80070021:鎖定區段 (父層 <section overrideModeDefault="Deny" />)。
解決:
1. 用 appcmd list config "Default Web Site" /section:system.webServer/security/authentication /commit:apphost 檢查鎖定。
2. <location path="." overrideMode="Allow"> 解鎖。
3. 修正 XML、授權 icacls "C:\inetpub\wwwroot\web.config" /grant "IIS_IUSRS:(R)"。

4. HTTP 503 - SERVICE_UNAVAILABLE

原因:應用程式集區已停止 (快速失敗保護觸發、啟動型別為 Disabled、身分識別密碼過期/錯誤、WAS 服務未啟動)。
排查:
1. IIS 管理員 → 應用程式集區 → 狀態「已停止」→ 啟動。
2. 事件檢視器 → System/Application → 事件 ID 5002/5011/5013/5036/5186/5189。
3. system32\inetsrv\config\applicationHost.config → <add name="MyPool" autoStart="true" />。
4. 身分識別:ApplicationPoolIdentity (推薦) 或 設定正確密碼的自訂帳號。
5. net start WAS / net start W3SVC 確認服務啟動。

5. 快速查詢表

子狀態碼意義關鍵設定
404.0找不到檔案/目錄靜態內容對應、虛擬目錄
404.3MIME 對應缺失<staticContent><mimeMap fileExtension=".woff2" mimeType="font/woff2" /></staticContent>
404.7要求篩選封鎖副檔名<requestFiltering><fileExtensions><add fileExtension=".config" allowed="false" /></fileExtensions></requestFiltering>
404.8隱藏區段 (web.config)<requestFiltering><hiddenSegments><add segment="web.config" /></hiddenSegments></requestFiltering>
404.11雙重逸出allowDoubleEscaping="true"
404.12高位元組序列allowHighBitCharacters="true"
404.13內容長度過大maxAllowedContentLength
404.14URL 過長maxUrl, maxQueryString
500.19組態讀取失敗XML/權限/鎖定
500.21模組辨識失敗ASP.NET 註冊 aspnet_regiis -i / dism /online /enable-feature /featurename:IIS-ASPNET45
503服務不可用AppPool 狀態、WAS、身分識別

記住:子狀態碼才是真相,瀏覽器只顯示 404/500,詳細錯誤需開啟 <httpErrors errorMode="DetailedLocalOnly" /> 或查看 %SystemDrive%\inetpub\logs\LogFiles\W3SVC1。

Copyright © Windows教程網 All Rights Reserved