title: IIS 7 throws "duplicate section defined" error for web.config on one server, but not another
body: <p>I have 3 servers, all of which are running Windows Web Server, .NET 4, and IIS7.  The beginning section of my web.config file is:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&gt;
    &lt;configSections&gt;
      &lt;section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;
      &lt;section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;
      &lt;section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;
      &lt;sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
        &lt;sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
          &lt;section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
          &lt;sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
            &lt;section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /&gt;
            &lt;section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
            &lt;section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
            &lt;section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
          &lt;/sectionGroup&gt;
        &lt;/sectionGroup&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
  </code></pre>
  
  <p>This works fine on 2 of the servers, but one of them reports the error:</p>
  
  <blockquote>
    <p>There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined </p>
  </blockquote>
  
  <p>against the line:</p>
  
  <pre><code>&lt;section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
  </code></pre>
  
  <p>If I remove that single line, then it complains about a duplicate of the next line, and so on until I remove almost all of the config sections.</p>
  
  <p>Any idea what would cause this?</p>
  
  <hr>
  
  <p><em>Edit:</em></p>
  
  <p>This was a .NET 3.5 application that was updated to VS 2010 and .NET 4. All 3 servers have .NET 2/3.5 and 4 installed.  The IIS app pools have all been updated to .NET 4.</p>
  
  <p>In all 3 servers, the <code>machine.config</code> file already has some of these web.config sections defined in it (as Damien's answer mentions), but only 1 of the 3 complains about it being duplicated.</p>