53

I am getting error (The configuration section system.web.extensions cannot be read because it is missing a section declaration) while installing my Web Application in Server 2008 32 bit machine with .NET Framework 4.0. but it works well in 2008 r2 64 bit machine.

This is my webconfig file info

<configuration>
<runtime>
    <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647"/>
      </webServices>
    </scripting>
  </system.web.extensions>
</configuration>

Any idea to get rid of this error?

Note: I have checked all the related entries in Stack over flow but nothing was useful for me

Thamotharan Karuppiah
  • 1,755
  • 1
  • 11
  • 14
Kevin M
  • 5,436
  • 4
  • 44
  • 46

7 Answers7

77

Try changing the application pool run time from .net 2.0 to .net 4.0

  • The default .NET version when I created a new app pool, in 2017, is .NET 2.0, from 2002. I can only imagine why. – Pathogen Oct 05 '17 at 18:49
  • 1
    Thank you for this. I recently downgraded .NET framework from 4.8 to 4.7.2, and when I removed 4.8 from the system, IIS decided to downgrade all my app pools. When I re-installed 4.7.2, it didn't set them back to the correct version. So your comment led me down the right path. – CyberInferno Aug 18 '19 at 06:14
48

The issue resolved for me after adding the following configuration setting in my webconfig file

<configSections>
    <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"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

We can refer this article for more info: http://www.morgantechspace.com/2013/11/The-configuration-section-system-web-extensions-cannot-be-read-because-it-is-missing-a-section-declaration.html

Kevin M
  • 5,436
  • 4
  • 44
  • 46
  • 1
    In my case, I didn't use scriptResourceHandler or jsonSerialization in my web.config and including the sections above caused the issue to continue. – Chartreugz Feb 24 '17 at 15:02
8

I also had the same problem after upgrading my OS from Windows Server 2003 to Windows Server 2008 R2 , I just changed the application pool settings to .NetFramework 4.0.0 and also changed the classic to Integrated mode ... my problems solved ..

user3946348
  • 81
  • 1
  • 1
2

Probably related question: .NET using wrong 2.0 machine.config instead of 4.0. I've experienced similar issue... And solution for me:

Not sure, that it's realy reason/solution, but last thing I've try it is (in IIS Manager):

  1. Navigate to server in right panel (root node)
  2. In the features list open "ISAPI and CGI Restrictions"
  3. There is 2 items with descriptions ASP.NET v4.0.30319 with restrictions set to Deny
  4. Set restrictions value to Allowed

This is last thing i've tried before issue is gone.

Community
  • 1
  • 1
Kiryl
  • 180
  • 13
1

Note down .netFramework version v4... (examplev4.0.030319) you have installed Edit your application pool to correct .NET Framework v4..

Good luck

-Satish

1

For me, changing the application pool .NET Framework version from v2.0 to v4.0 solved this issue.

Open IIS --> Select App Pools --> Select App Pool from list --> From context menu select Basic Settings... --> Change .NET Frame version to v4.0

Ross
  • 365
  • 6
  • 8
0
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

I tried this and it works good for me. Maybe helpful to someone.

double-beep
  • 5,031
  • 17
  • 33
  • 41