'System.Web.Extensions' trouble deploying .Net Framework 4 Website on IIS7 'System.Web.Extensions' trouble deploying .Net Framework 4 Website on IIS7 asp.net asp.net

'System.Web.Extensions' trouble deploying .Net Framework 4 Website on IIS7


You can also get this very same error if you create a new website in IIS 7(.5) as the application pool it creates for the new site may still be set to 2.0, and as such, system.web.extensions is not valid in a 2.0 configuration file.

Simply go into IIS Manager, choose the application pools, select the one for your app, right-click, Advanced Settings and set .NET framework version to v4.


Module  IIS Web CoreNotification    BeginRequestHandler Not yet determinedError Code  0x80070032Config Error    The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration Config File \\web.config

The error is due to this system.web.extensions section added to the Web.config

<system.web.extensions><scripting><webServices><!-- Uncomment this line to customize maxJsonLength and add a custom converter   <jsonSerialization maxJsonLength="1024000">--></webServices><scriptResourceHandler enableCompression="true" enableCaching="true"/></scripting></system.web.extensions>

For some reason adding that section, overrides the system.web.extensions group. The solution is to

  1. Comment the code above if you don't need it.
  2. Add the code below to the Web.config section group

..

<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>


I could solve this issue myself after some hunting around (happens!).

apparently has nothing to do with the way the config file is structured, it is the assembly for ASP.Net Ajax which is not deployed on my target server but might be present on my dev machine.

I deleted the entry from the web.config file and this issue was resolved, there were some other minor issues but nothing worth mentioning.

The deployment experience for IIS7+.Net Framework 4 wasn't too difficult and the added capabilities will going to be worth it.