Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / IIS

IIS Deployment Error: There is a Duplicate scriptResourceHandler Section Defined

15 Sep 2011CPOL 142.6K  
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)