加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

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

发布时间:2020-12-16 00:30:48 所属栏目:asp.Net 来源:网络整理
导读:当我运行我的.aspx页面时,我收到以下错误。 错误Code0x8007000d 配置部分的“重写”无法读取,因为它缺少一个段声明 我有一个简单的v.aspx页面,其中包含以下代码: 的Response.Write(请求( “Q”)) 我的主机服务器作为IIS 7安装了URL重写功能启用(这就是他
当我运行我的.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.webServeru0026gt中;部分。
<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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读