Alex Rivera | Logout

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

Asked 2010-03-23T07:19:27.363
20

I am trying to deploy a .Net framework 4 website on IIS7 server. I have already changed the application-pool's target framework to .Net 4, but the app is still showing me the error:

"The configuration section 'system.web.extensions' cannot be read because it is missing a section declaration"

I am guessing that has something to do with the new feature of .Net4 that lets me have a compact Web config file. I think for some reason IIS7 is not happy with this.

What can I do to deploy this app successfully or do I have to scale back to v3.5? I am sure there is a solution out there.

Do you have any suggestions?

Edit
Report

3 Answers

10
Module  IIS Web Core
Notification    BeginRequest
Handler Not yet determined
Error Code  0x80070032
Config 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, 
answered 2011-03-07T16:48:43.710
2

It’s because you’ve deployed your application on to an IIS Server where the application’s AppPool is set to run under the DefaultAppPool. DefaultAppPool is automatically configured to run under .NET 2.0 rather than .NET 4.0. This means that the System.Web.Extensions stuff is unavailable to that version of the .NET Framework.

To change the Application Pool (AppPool) settings for your web application

1. Select the application directory 
2. Under Actions, click Basic Settings…
3. Change the Application Pool to ASP.NET v4.0 (or another .NET 4.0 app pool) by clicking on the Select… button.
4. Click OK

Re-run your application and it should work.

Check this link for graphical demonstration.

answered 2011-10-28T12:03:00.340
1

I solved the issue by following below steps: 1. set application pool framework to 4.0
2. if point 1 wont work, then problem could be related to config inheritance. Apply hotfix from http://support.microsoft.com/kb/958854

This should solve the issue.

answered 2013-04-26T10:43:04.650

Your Answer