微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

asp.net – URL重写 – web.config错误

当我运行我的.aspx页面时,我收到以下错误

错误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>

搜索了stackoverflow,但没有找到解决方案。

可能有人找到解决方案。

TIA

解决方法

确保你的< rewrite>包含在< system.webServer>< /system.webServer\u0026gt中;部分。
<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>

原文地址:https://www.jb51.cc/aspnet/252463.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐