Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

Windows 2008 IIS7 偽靜態 URL 包含特殊符號/空格導致 404.11 解決方案

編輯:關於伺服器

IIS 7 請求篩選模組預設阻擋雙重轉義序列,導致包含空格(+ 或 %20)等特殊字元的偽靜態 URL 返回 HTTP 404.11。

錯誤特徵

請求篩選模組被配置為拒絕包含雙重轉義序列的請求
HTTP 錯誤 404.11 - Not Found

解決方法:啟用 allowDoubleEscaping

方法一:修改 ApplicationHost.config(全域生效)

  1. 開啟 %windir%\system32\inetsrv\config\applicationHost.config
  2. 定位 <requestFiltering> 節點(約第 360 行)
  3. 修改為:<requestFiltering allowDoubleEscaping="true">

方法二:網站層級 web.config 覆蓋(推薦,隔離範圍)

<configuration>
  <system.webServer>
    <security>
      <requestFiltering allowDoubleEscaping="true" />
    </security>
  </system.webServer>
</configuration>

原理說明

  • allowDoubleEscaping="true" 允許請求 URL 中包含 %25(% 的編碼)等雙重編碼字元
  • 空格在 URL 中常編碼為 + 或 %20,經過多層轉發可能產生雙重編碼
  • 預設關閉是為防止路徑遍歷攻擊,啟用後需確保應用層輸入驗證完善

驗證步驟

  1. 修改配置後執行 iisreset 或重啟網站
  2. 訪問原報錯 URL(如 /product/k-+xxx.htm)
  3. 確認正常返回 200 而非 404.11
Copyright © Windows教程網 All Rights Reserved