Click here to Skip to main content
15,879,474 members
Articles / Web Development / IIS

IIS Deployment Error: There is a Duplicate scriptResourceHandler Section Defined

Rate me:
Please Sign up or sign in to vote.
4.93/5 (7 votes)
15 Sep 2011CPOL 139.5K   3   4
How to fix this IIS deployment error

A few days ago, I was attempting to deploy a .NET 3.5 website on the default app pool in IIS 7 having the framework section set to 4.0, and I got the following error:

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

The problem occurs because when you use framework 4.0, the machine config already has some of the sections defined that were used in previous ASP.NET versions. So replace the sectionGroup of your existing web.config with the below configs:

XML
<sectionGroup name="system.web.extensions" 
  type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, 
        Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" 
  type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, 
        Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" 
  type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, 
        Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
  requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" 
  type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, 
        Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" 
  type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, 
        Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
  requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" 
  type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, 
        Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
  requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" 
  type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, 
        Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
  requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" 
  type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, 
        Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
  requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>

Another workaround is to rebuild the website/web application using framework 4, and the problem goes away.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
Bangladesh Bangladesh
I am a Software Engineer and Microsoft .NET technology enthusiast. Professionally I worked on several business domains and on diverse platforms. I love to learn and share new .net technology and my experience I gather in my engineering career. You can find me from here

Personal Site
Personal Blog
FB MS enthusiasts group
About Me

Comments and Discussions

 
QuestionAlternative Pin
porcus5-Dec-12 13:55
porcus5-Dec-12 13:55 
QuestionIIS deployment error Pin
Niroj Sc Ray30-Nov-12 18:08
Niroj Sc Ray30-Nov-12 18:08 
GeneralMy vote of 5 Pin
EScharneck6-Sep-12 1:11
EScharneck6-Sep-12 1:11 
GeneralMy vote of 5 Pin
Rubaba11-Dec-11 0:32
Rubaba11-Dec-11 0:32 
helpful

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.