首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >URL重写- web.config错误

URL重写- web.config错误
EN

Stack Overflow用户
提问于 2009-11-16 04:36:02
回答 3查看 29.6K关注 0票数 21

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

错误Code0x8007000d无法读取配置节'rewrite‘,因为它缺少节声明

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

Response.Write(请求(“q”))

我的主机服务器安装了IIS 7,并启用了URL重写功能(这是他们所声称的)

我的web.config文件在下面有以下几行:

注意:节点下面有蓝色的曲线条。

代码语言:javascript
复制
<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,但没有找到解决方案。

也许有人找到了解决方案。

提亚

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2009-11-16 05:55:59

确保您的<rewrite>包含在<system.webServer></system.webServer>部分中。

代码语言:javascript
复制
<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>
票数 33
EN

Stack Overflow用户

发布于 2012-06-20 21:34:50

安装URL重写模块http://www.iis.net/download/URLRewrite,并对其进行排序。它解决了我的问题

票数 18
EN

Stack Overflow用户

发布于 2012-04-17 22:39:30

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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1738735

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档