URL重写 - web.config中的错误 [英] URL rewrite - web.config error
问题描述
我收到以下错误,当我跑我的.aspx页。
I am getting the following error when i run my .aspx page.
错误code0x8007000d
配置节'改写'不能读,因为它缺少一个部分声明
我有具有以下code简单v.aspx页:
I have a simple v.aspx page which has the following code:
的Response.Write(请求(Q))
Response.Write(Request("q"))
我的托管服务器IIS 7中启用URL重写功能(这是他们声称的)安装
My hosting server as IIS 7 installed with URL rewrite feature enabled (that's what they claim)
我的web.config文件下有下面几行:
My web.config file has the following lines under :
请注意:该节点已根据它的蓝色波浪线
Note: The node has blue squiggly lines under it
<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>
我已搜查计算器,但没有找到一个解决方案。
I have searched stackoverflow but did not find a solution.
可能是有人找到了解决办法。
May be someone found a solution.
TIA
推荐答案
请确保您的&LT;改写&GT;
被封闭在&lt;系统.webServer&GT;&LT; /system.webServer>
部分
Make sure your <rewrite>
is enclosed in the <system.webServer></system.webServer>
section.
<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重写 - web.config中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!