元素'system.webServer'具有无效的子元素'rewrite'.我应该解决这个问题吗?

Jas*_*ber 23 vb.net asp.net web-config visual-studio-2010 visual-studio

我在IIS7中做了很多重写规则,比如删除尾部斜杠,canonnical URL,小写字母等等.IIS改变了我的web.config,一切都在网站上运行正常,就像它应该的那样.但是在Visual Studio web.config中,开始<rewrite>语句用蓝色加下划线,在VS的底部,它表示元素'system.webServer'具有无效的子元素'rewrite'.但这就是IIS如何制作它......我没有手动执行此操作.我是否应该关注这个VS错误,或者我应该保持原样,因为它的工作原理是什么?

这是我的web.config的一个例子:

    <system.webServer>
    <rewrite>         <-------------------- this is underlined in squiggly blue
        <rules>
            <rule name="RemoveASPX" enabled="true" stopProcessing="true">
                <match url="(.*)\.aspx" />
                <action type="Redirect" url="{R:1}" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{URL}" pattern="(.*)/default.aspx" negate="true" />
                    <add input="{URL}" pattern="(.*)/admin/*" negate="true" />
                    <add input="{URL}" pattern="(.*)/desktopmodules/*" negate="true" />
                </conditions>
            </rule>
Run Code Online (Sandbox Code Playgroud)

大约有5或6个其他规则,然后在结束</system.webServer>时结束.

GEO*_*HET 22

这里更新的架构为我解决了这个问题.

http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/

确保更改VS2010的脚本:

ruslany于2009年10月20日下午7:10回复#

@Gene:这是因为XML架构缓存位于VS2010的不同位置.您可以打开UpdateSchemaCache.js并替换此行:

var vs9CommonTools = shell.ExpandEnvironmentStrings("%VS90COMNTOOLS%");

用这一行:

var vs9CommonTools = shell.ExpandEnvironmentStrings("%VS100COMNTOOLS%");

之后尝试运行脚本,看看是否有帮助.

  • 对于Visual Studio 2012,请改用http://blog.vanmeeuwen-online.nl/2013/04/visual-studio-2012-xml-intellisense-for.html (11认同)