【问题标题】:URL rewrite - web.config errorURL 重写 - web.config 错误
【发布时间】:2010-12-16 20:39:16
【问题描述】:

运行 .aspx 页面时出现以下错误。

错误码0x8007000d 无法读取配置节“重写”,因为它缺少节声明

我有一个简单的 v.aspx 页面,其中包含以下代码:

Response.Write(Request("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

【问题讨论】:

    标签: asp.net iis-7 url-rewriting


    【解决方案1】:

    确保您的 &lt;rewrite&gt; 包含在 &lt;system.webServer&gt;&lt;/system.webServer&gt; 部分中。

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

    【讨论】:

    • 包含在 部分中。
    【解决方案2】:

    安装 URL 重写模块 http://www.iis.net/download/URLRewrite 并且应该排序。它解决了我的问题

    【讨论】:

    【解决方案3】:

    在 IIS7 中支持 system.webServer 中的重写部分,但在 IIS6 中不支持。该错误可能是由于将此站点部署到仅运行 IIS6 的服务器而引起的。

    【讨论】:

    • IIS8 也遇到了这个问题。进行安装修复它。
    猜你喜欢
    • 1970-01-01
    • 2014-06-13
    • 1970-01-01
    • 2017-08-23
    • 2012-06-04
    • 2012-12-06
    • 2011-05-23
    • 2014-08-12
    • 1970-01-01
    相关资源
    最近更新 更多