Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 910
Jason Weber Avatar asked Feb 14 '12 16:02

Jason Weber


1 Answers

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.

like image 178
GEOCHET Avatar answered Sep 22 '22 07:09

GEOCHET