find a location for property in a new city

Monday 29 March 2010

There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined

I managed to get "The requested page cannot be accessed because the related configuration data for the page is invalid." errors with a config error of "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined" after trying to be clever. Here is the problem and solution.

Keen to try .NET4's new arsenal but trying to create physical separation from my current .NET3.5 (.NET2 runtime) solution, I decided to create a new ASP.NET MVC2 project and use a virtual application in IIS7, set to use the .NET4 application pool to make it appear on a /mvc subdirectory rather than an entirely new site.

Then my old friend "Yellow Screen of Death" reared his, quite frankly, ugly head and started hurling abuse at me for defining duplicate sections. He has no subtlety.

Well he is lieing! I have not added duplicates. This ungoogleable problem was causing me grief because of some complete falsity. I removed the "duplicate" from the web root web.config and then it had a problem with the next defined section. Then the next and the next. I removed them all and then it got its knickers in a twist about something else.

Time to take a step back

What am I trying to do? Run a .NET4 application from a .NET2 runtime... oh right... yeah.

I stopped my quest and started a new site in IIS for this MVC2 application, now all is well. Those errors were complete red herrings though and I suppose my head wasn't quite in gear since it was late on a Friday and there was drinking to be done!


If you are still struggling with this and you aren't using .NET v2 and v4 together there is still more help in this post about solving web.config inheritance.

Update 2:

If you are using .NET 4 as a child to a .NET 2 parent application then you will need to read this to solve all your problems :) ASP.NET 4 Child Applications Fail to Start When Under ASP.NET 2.0 or ASP.NET 3.5 Applications

Follow britishdev on Twitter


  1. Not sure if this helps - your solution of creating a site worked because it removed the web.config inheritance. This post explains how it worked, and what it actually is. Might be helpful for anyone else pulling their hair out on this same issue.

  2. Thanks. I found and tried putting <location inheritInChildApplications="false"> around the troublesome parts. This looks like it would work for stopping certain settings being inherited by child applications. However, my application just wasn't happy. The web.config are wildly different in .NET4. You can see this by changing the target framework of the child application from 4 down to 3.5!

  3. Basically your problem is that in .net 4.0

    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
    are now in the machine.config.
    so declaring it in your web.config is a duplication.

    if you remove it then it all works even with a 3.5 built dll. (haven't tried 2.0 yet but the theory stands)

  4. This is true. See update 2 in my post for Microsoft's in depth workaround. (Although, personally I just upgraded everything to .NET 4)

  5. thanks dear a lot and a lot
    I was facing the same problem and now solved the way you told us. thanks thanks ......

  6. Please Any one con help me....
    When I deployed my site then it have error-

    Error Code 0x800700b7
    Config Error There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined

    web.config error--


    when we run my site on remote server then we found these errors.
    I tried to find the duplicate but we con't find it in my web.config file. I have build my site in visual studio 2008 with ajaxtoolkit and javascript.
    Please help me for the hosting of my site.
    thanking you.

  7. my web.config file.

  8. Hi,

    I also face the same problem while creating the new application.

    After digging into the error i found the solution which is regarding to the .Net Framework version of the application pool of the created for new web application.

    Some how the application pool defaults set to v4.0 instead of v2.0. So i have updated the same with v2.0 and created application again.

    For more details please have look of the link []

  9. hmm seems my last comment didn't get through, just wanted to say THANK YOU THANK YOU THANK YOU xD
    seriously facepalmed when i realized it was .net framework 2 runtime