对于我在 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 的脚本:
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.
关于asp.net - 元素 'system.webServer' 具有无效的子元素 'rewrite' 。我应该解决这个问题吗?如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9280803/