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

本文介绍了解决在web.config文件中使用URL Rewrite模块时出现的'system.webServer'有无效子元素'rewrite'的问题。提供了详细的步骤来注册URL重写模式到Visual Studio,从而启用XML IntelliSense支持。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错信息:

'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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值