Using Url Rewrite Model In IIS7 and Display Error ('system.webServer' has invalid child element 'rewrite' 。。。)

报错信息:

'system.webServer' has invalid child element 'rewrite'. List of possible elements expected: 'asp, caching, cgi, defaultDocument, directoryBrowse, globalModules, handlers, httpCompression, httpErrors, httpLogging, httpProtocol, httpRedirect, httpTracing, isapiFilters, modules, odbcLogging, security, serverRuntime, serverSideInclude, staticContent, tracing, urlCompression, validation, management

解决方案:

If you ever tried to write or modify rewrite rules in web.config file by using Visual Studio 2008 XML Editor, you may have noticed that the Visual Studio XML IntelliSense does not work for all URL Rewrite Module configuration elements. This is because the XML schema for <rewrite> element is not registered in Visual Studio Schema Cache. This post provides the instructions on how to register URL Rewrite schema with Visual Studio to enable IntelliSense support.

To enable IntelliSense support for URL Rewrite 1.1 follow these steps:

Step 1: Download the URL Rewrite schema from the location below:

VS IntelliSense for URL Rewrite

Disclaimer: The schema file and the helper script file contained in this package are provided by me and not by Microsoft. The are not officially supported by Microsoft. Use them at your own risk.

Step 2: Extract the content of the file to a directory of your choice, for example C:\rewrite_vsintellisense\

Step 3: Start the elevated privilege command line window by typing “cmd” in the search bar of the Windows Start Menu and then right clicking the “cmd” item in the search result and selecting “Run As Administrator”.

Step 4: In the command line window type the following:

  1. cd \rewrite_intellisense 
cd \rewrite_intellisense

Replace the path if you unpacked the files into a different location

  1. cscript UpdateSchemaCache.js 
cscript UpdateSchemaCache.js

You should see the output as below:

Run the UpdateSchemaCache.js

Check that the XML IntelliSense in Visual Studio XML editor works now:

Intellisense for URL Rewrite Configuration in Visual Studio

In case you want to restore back the original XML schema used by Visual Studio, here is how you can do it:

  1. cd “%ProgramFiles%\Microsoft Visual Studio 9.0\Xml\Schemas"  
  2. move DotNetConfig_beforeRewrite.xsd DotNetConfig.xsd 
posted @   RicoRui  阅读(1261)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
历史上的今天:
2007-08-22 SQL存储过程的调试
2007-08-22 firefox代理服务器,排除地址设置的一些经验
2007-08-22 JavaScript开发工具--Aptana
点击右上角即可分享
微信分享提示