Warning 1 The element
‘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’. D:\PROJEKTI\FoodOrder\FoodOrder\Web.config 185 4 FoodOrder
码:
system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true"> <remove name="ScriptModule" /> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule,System.Web.Extensions,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35" /> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated" /> <remove name="ScriptHandlerFactory" /> <remove name="ScriptHandlerFactoryAppServices" /> <remove name="ScriptResource" /> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory,PublicKeyToken=31BF3856AD364E35" /> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory,PublicKeyToken=31BF3856AD364E35" /> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,PublicKeyToken=31BF3856AD364E35" /> </handlers> <rewrite> <rewriteMaps> <rewriteMap name="StaticRewrites"> <!--<add key="/Default.aspx" value="/Default.aspx" />--> </rewriteMap> </rewriteMaps> <rules>
解决方法
当Visual Studio IntelliSense在模式文件上找不到有关重写模块的信息时,会发生这种情况。因此,我们需要在文件中添加重写段的模式:DotNetConfig.xsd
Ruslan提供非正式的模式来重写。对于Visual Studio 2010,请从他的页面:http://ruslany.net/2010/04/visual-studio-xml-intellisense-for-url-rewrite-2-0/下载xml模式
对于早期版本从这里下载:
http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/#comment-1402
对于这两个版本,说明为here。
对于VS2010,请记住用%VS100COMNTOOLS%代替%VS90COMNTOOLS%
对于VS2012及更高版本,请遵循fftsys’s article。
如果你不想使用ruslany的脚本,你仍然可以使用重写模块。在这种情况下,您仍然可以修改web.config,从visual studio中添加重写部分。
IIS的原始重写模块来自Microsoft:http://www.iis.net/downloads/microsoft/url-rewrite,由他们支持。 ruslany的脚本只支持Visual Studio,以便VS识别它。