18

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...

Richard Ev
  • 52,939
  • 59
  • 191
  • 278
senzacionale
  • 20,448
  • 67
  • 204
  • 316

1 Answers1

26

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.

Atiq Rahman
  • 680
  • 6
  • 24
  • 5
    Here is some details on VS2012 as well: http://stackoverflow.com/questions/13120726/url-rewrite-with-visual-studio-2012 – Mark May 17 '13 at 06:59
  • By reading the Disclaimer that has been provided there it`s very difficult to implement this. As in any case this could cause a failure then ? – Abid Ali Oct 07 '13 at 11:15
  • @AbidAli: please check last two paras of the answer. – Atiq Rahman Feb 23 '14 at 03:18
  • That webpage looks like it might be dead. Is there anywhere else we can get it? –  Jul 20 '15 at 10:32
  • We can notify him that his site is down - https://forums.iis.net/members/ruslany.aspx or I will upload a copy myself if I find a copy in my computer. That I will do after I return from work. – Atiq Rahman Jul 20 '15 at 16:23