title: Problem with <system.web.extensions> config group when upgrading to .NET 4.0
body: <p>So we've upgraded our site from 3.5 SP1 -> .NET 4.</p>
  
  <p>When we ran the site, we got an Internal Server Error (500), stating the following configuration group could not be read:</p>
  
  <pre><code>&lt;system.web.extensions&gt;
          &lt;scripting&gt;
              &lt;scriptResourceHandler enableCompression="true" enableCaching="true" /&gt;
              &lt;webServices&gt;
                  &lt;jsonSerialization maxJsonLength="999999" /&gt;
              &lt;/webServices&gt;
          &lt;/scripting&gt;
      &lt;/system.web.extensions&gt;
  </code></pre>
  
  <p>We commented out this section and the website ran fine (but now we are getting problems with JSON - because of the above required property).</p>
  
  <p>We've read threads on this issue, and most of them say "Your application pool is not running 4.0". And it is, so that's not the issue.</p>
  
  <p>I've also read threads saying IIS is somehow reading an old machine.config file.</p>
  
  <p>With .NET 4, as you know a lot of the sections of web.config have been moved to machine.config.</p>
  
  <p>So we put this section back in the top of the web.config:</p>
  
  <pre><code>&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;
  </code></pre>
  
  <p>And the website now seems to work ok.</p>
  
  <p>Still, im a little concerned if this is the correct solution.</p>
  
  <p>Any ideas people? Is this the correct fix? </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>3 weeks and no answers...damn. =)  </p>