2009-11-15 75 views
17

我在運行.aspx頁面時出現以下錯誤。URL rewrite - web.config錯誤

錯誤Code0x8007000d 配置節「改寫」不能讀,因爲它缺少一個部分聲明

我有具有以下代碼的簡單v.aspx頁:

的Response.Write (請求( 「q」))

我的託管服務器IIS 7中啓用URL重寫功能安裝(這是他們所聲稱的)

我的web.config文件中有如下行下:

注:該節點下它

<rewrite> 
     <rules> 
     <rule name="RewriteUserFriendlyURL1" stopProcessing="true"> 
      <match url="^([^/]+)/?$" /> 
      <conditions> 
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
      </conditions> 
      <action type="Rewrite" url="v.aspx?q={R:1}" /> 
     </rule> 
     </rules> 
    </rewrite> 

我尋覓計算器,但沒有找到解決的辦法有藍色的波浪線。

可能是某人找到了解決方案。

TIA

回答

27

確保您<rewrite>被封閉在<system.webServer></system.webServer>部分。

<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
      <rule name="RewriteUserFriendlyURL1" stopProcessing="true"> 
      <match url="^([^/]+)/?$" /> 
      <conditions> 
       <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
       <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
       </conditions> 
       <action type="Rewrite" url="v.aspx?q={R:1}" /> 
      </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 
+2

包含在部分。 – 2009-11-15 23:07:11

3

system.webServer中的rewrite部分在IIS7中支持,但不支持IIS6。該錯誤可能是由於將該站點部署到僅運行IIS6的服務器所致。

+0

遇到此問題以及IIS8。做安裝修復它。 – Kai 2016-02-03 10:15:18

16

安裝URL重寫模塊http://www.iis.net/download/URLRewrite並且應該排序。它修復了我的問題

+0

這也解決了我的問題,謝謝! – Scott 2014-05-15 12:03:09

+2

也適用於我,但我使用網絡平臺安裝程序來添加它。 – Kieran 2016-03-13 01:28:29

+0

下載網址已被刪除,您可以從這裏下載:https://www.microsoft.com/en-eg/download/confirmation.aspx?id = 7435 – 2017-03-15 13:25:15