[英]URL rewrite - web.config error
當我運行.aspx頁面時,我收到以下錯誤。
錯誤代碼0x8007000d無法讀取配置節'重寫',因為它缺少節聲明
我有一個簡單的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>
我搜索了stackoverflow但沒有找到解決方案。
可能是有人找到了解決方案。
TIA
確保<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>
安裝URL重寫模塊http://www.iis.net/download/URLRewrite ,應該排序。 它解決了我的問題
IIS7中支持system.webServer中的重寫部分,但不支持IIS6。 將此站點部署到僅運行IIS6的服務器可能會導致該錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.