对于IIS7中执行的许多操作,我有许多重写规则,例如删除结尾的斜杠,规范的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>
大约还有其他5或6条规则,最后是结束
</system.webServer>
。 最佳答案
这里更新的架构为我解决了这个问题。
http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/
确保更改VS2010的脚本: