[英]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.