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

标签 asp.net vb.net visual-studio visual-studio-2010 web-config

对于我在 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/

相关文章:

c# - Gridview数据绑定(bind)下拉列表和更新

asp.net - 如何在asp.net mvc5中创建动态角色

.net - IEnumerable 在 COM 中可见,但 ICollection 不可见?

c# - 你能把它转换成VB吗?

visual-studio - 为什么 Visual Web Developer 2008/2010 不再在 Firefox 中调试 silverlight 应用程序?

visual-studio - 如何将外部文件与程序集关联

c# - 在 C# 中优雅地处理重复的属性代码

c# - 从C#中的最后一个对象开始循环

sql - 如何获得 SqlCommand ExecuteNonQuery 结果?

c# - 如何在 .NET 中完全摆脱 View 状态