Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
515 views
in Technique[技术] by (71.8m points)

asp.net - Element 'system.webServer' has invalid child element 'rewrite'. Should I fix this, and how?

I have a number of rewrite rules for a lot of things that I did in IIS7, like removing trailing slashes, canonnical URLs, lowercase lettering, and such. IIS altered my web.config, and everything works fine on the website, like it should. But in the Visual Studio web.config, the opening <rewrite> statement is underlined in blue, and at the bottom of VS, it says that the element 'system.webServer' has invalid child element 'rewrite'. But this is how IIS made it ... I didn't do this manually. Should I be concerned with this VS error, or should I just leave as be, since it's working how it should work?

Here's an example of my 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>

There are about 5 or 6 other rules, then a closing </system.webServer> at the end.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The updated schema here fixed this for me.

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

Make sure you change the script for VS2010:

ruslany responded on 20 Oct 2009 at 7:10 pm #

@Gene: This is be because the XML schema cache is located in a different location in VS2010. Can you open the UpdateSchemaCache.js and replace this line:

var vs9CommonTools = shell.ExpandEnvironmentStrings( “%VS90COMNTOOLS%” );

with this line:

var vs9CommonTools = shell.ExpandEnvironmentStrings( “%VS100COMNTOOLS%” );

After that try running the script and see if that helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...