Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The element > system.webServer' has invalid child > element 'rewrite'

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

code:

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, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </handlers>
        <rewrite>
            <rewriteMaps>
                <rewriteMap name="StaticRewrites">
                    <!--<add key="/Default.aspx" value="/Default.aspx" />-->
                </rewriteMap>
            </rewriteMaps>
            <rules>

page works but i always get warning of this and when i publish page i get publish error becouse of this...

like image 262
senzacionale Avatar asked Mar 15 '11 08:03

senzacionale


1 Answers

Possible duplicate of asp.net, url rewrite module and web.config

This happens when Visual Studio IntelliSense doesn't find information about rewrite module on schema file. Hence we need to add schema for rewrite section in a file specifically: DotNetConfig.xsd

Ruslan provides unofficial schema for rewrite. For Visual Studio 2010, please download xml schema from his page: http://ruslany.net/2010/04/visual-studio-xml-intellisense-for-url-rewrite-2-0/

For earlier versions download from here: http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/#comment-1402

For both versions, instructions are here.

For VS2010 remember to replace %VS90COMNTOOLS% with %VS100COMNTOOLS%

For VS2012 and later, follow fftsys's article.

If you do not want to use ruslany's script you can still use rewrite module. In that case, you still can modify web.config to add rewrite section out of visual studio.

Original rewrite module for IIS comes from Microsoft: http://www.iis.net/downloads/microsoft/url-rewrite and supported by them. ruslany's script just enables support in Visual Studio so that VS recognizes it.

like image 57
Atiq Rahman Avatar answered Oct 14 '22 06:10

Atiq Rahman