2

I have a .NET web application installed on a Windows Server 2008 R2 Datacenter with .NET Framework 4.0 (IIS 7.5). I have a main 4.0 app and a nested 2.0 app. I have configured IIS for each app. The 2.0 folder was converted to an app and it runs in a 2.0 app pool. The 4.0 app is the root app and it is set to run in a 4.0 app pool.

This is the web.config of the main 4.0 app:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net" />
</configSections>
<exceptionHandling>
<exceptionPolicies>
  <add name="LibraryPolicy">
    <exceptionTypes>
      <add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" />
    </exceptionTypes>
  </add>
</exceptionPolicies>
</exceptionHandling>
<log4net>
...
</log4net>
<connectionStrings>
...
</connectionStrings>
<appSettings>
...
</appSettings>
<location inheritInChildApplications="false">
    <system.web>
        <httpRuntime executionTimeout="300" maxRequestLength="51200" requestValidationMode="2.0" />
        <authorization>
            <deny users="?" />              
        </authorization>            
        <compilation debug="false" targetFramework="4.0">
            <assemblies>
                <add assembly="System.Web.Mobile, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            </assemblies>
        </compilation>

        <customErrors mode="RemoteOnly" />

        <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" stateNetworkTimeout="10" sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI" sqlCommandTimeout="30" customProvider="" cookieless="UseCookies" cookieName="ASP.NET_SessionId" timeout="3000" allowCustomSqlDatabase="false" regenerateExpiredSessionId="true" partitionResolverType="" useHostingIdentity="true">
            <providers>
                <clear />
            </providers>
        </sessionState>

        <authentication mode="Forms">
            <forms loginUrl="public/default.aspx" name=".ABABABA" timeout="3000" />
        </authentication>

        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />

    </system.web>
</location>
<location path="app20" allowOverride="false">
    <system.web>
        <trust level="High" />
    </system.web>
  </location>
<location path="ScriptResource.axd">
    <system.web>
        <authorization>
            <allow users="*" />
            <deny users="?" />
        </authorization>
    </system.web>
</location>
<location path="WebResource.axd">
    <system.web>
        <authorization>
            <allow users="*" />
            <deny users="?" />
        </authorization>
    </system.web>
</location>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated" />
        <remove name="ScriptHandlerFactory" />
        <remove name="ScriptHandlerFactoryAppServices" />
        <remove name="ScriptResource" />
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
    <urlCompression doDynamicCompression="true" />
    <tracing>
        <traceFailedRequests>
            <add path="*">
                <traceAreas>
                    <add provider="WWW Server" areas="Rewrite" verbosity="Verbose" />
                </traceAreas>
                <failureDefinitions statusCodes="200-399" />
            </add>
        </traceFailedRequests>
    </tracing>
    <defaultDocument enabled="true">
        <files>
            <clear />
            <add value="Default.aspx" />
            <add value="Index.html" />
            <add value="Index.htm" />
            <add value="Index.cfm" />
            <add value="Index.shtml" />
            <add value="Index.shtm" />
            <add value="Index.stm" />
            <add value="Index.php" />
            <add value="Index.php3" />
            <add value="Index.asp" />
            <add value="Index.aspx" />
            <add value="Default.htm" />
            <add value="Default.asp" />
        </files>
    </defaultDocument>
    <httpProtocol>
        <customHeaders>
            <remove name="X-Powered-By" />
            <add name="X-UA-Compatible" value="IE=Edge,chrome=1" />
        </customHeaders>
    </httpProtocol>
    <httpRedirect enabled="false" />
    <rewrite>
        <rules>
            <rule name="CanonicalHostNameRule1">
                ...
            </rule>
        </rules>
    </rewrite>
</system.webServer>
<system.serviceModel>
    <bindings>
        ...
    </bindings>        
    <client>
        ...
    </client>
</system.serviceModel>
<system.web>
    <globalization culture="es-ES" uiCulture="es-ES" />
    <machineKey decryptionKey="..." validationKey="..." />
</system.web>
</configuration>

And this is the web.config of the nested 2.0 app:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
            <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
                <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
                <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /></sectionGroup>
        </sectionGroup>
    </sectionGroup>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
</configSections>
<log4net>
...
</log4net>
<connectionStrings>
    <clear />
    ...
</connectionStrings>
<system.web>
    <pages>
        <controls>
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></controls>
    </pages>
    <compilation debug="false">
        <assemblies>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
            <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies></compilation>
    <customErrors mode="RemoteOnly" />
    <authentication mode="Forms">
        <forms cookieless="UseCookies" loginUrl="..." name="..." path="/" protection="All" slidingExpiration="true" timeout="300" />
    </authentication>
    <httpHandlers>
        <clear />
        <remove verb="*" path="*.asmx" />
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
    </httpHandlers>
    <httpModules>
        <clear />
        <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
    <machineKey validationKey="..." decryptionKey="..." validation="SHA1" />
</system.web>
<system.web.extensions>
    <scripting>
        <webServices>
        </webServices>
        <scriptResourceHandler enableCompression="true" enableCaching="false" />
    </scripting>
</system.web.extensions>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
        <remove name="ScriptModule" /><add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
    <handlers>
        <remove name="SimpleHandlerFactory-ISAPI-2.0-64" />
        <remove name="PageHandlerFactory-ISAPI-2.0-64" />
        <remove name="HttpRemotingHandlerFactory-soap-ISAPI-2.0-64" />
        <remove name="HttpRemotingHandlerFactory-rem-ISAPI-2.0-64" />
        <remove name="xoml-ISAPI-2.0" />
        <remove name="xoml-Integrated" />
        <remove name="xoml-64-ISAPI-2.0" />
        <remove name="WebServiceHandlerFactory-ISAPI-2.0" />
        <remove name="TRACEVerbHandler" />
        <remove name="SimpleHandlerFactory-ISAPI-2.0" />
        <remove name="SimpleHandlerFactory-Integrated" />
        <remove name="rules-ISAPI-2.0" />
        <remove name="rules-Integrated" />
        <remove name="rules-64-ISAPI-2.0" />
        <remove name="PageHandlerFactory-ISAPI-2.0" />
        <remove name="PageHandlerFactory-Integrated" />
        <remove name="OPTIONSVerbHandler" />
        <remove name="HttpRemotingHandlerFactory-soap-ISAPI-2.0" />
        <remove name="HttpRemotingHandlerFactory-soap-Integrated" />
        <remove name="HttpRemotingHandlerFactory-rem-ISAPI-2.0" />
        <remove name="HttpRemotingHandlerFactory-rem-Integrated" />
        <remove name="AXD-ISAPI-2.0" />
        <remove name="ScriptHandlerFactory" />
        <remove name="ScriptHandlerFactoryAppServices" />
        <remove name="ScriptResource" /><remove name="WebServiceHandlerFactory-Integrated" />
        <add name="Ashx ext" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
        <add name="Aspx ext" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode" />
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
    <urlCompression doDynamicCompression="true" />
    <httpRedirect enabled="false" destination="..." childOnly="false" />
    <defaultDocument>
        <files>
            <remove value="Default.aspx?..." />
            <remove value="default.aspx" />
        </files>
    </defaultDocument>
    <httpErrors errorMode="Detailed" />
</system.webServer>
<appSettings>
    <clear />
</appSettings>
<location path="ScriptResource.axd">
    <system.web>
        <authorization>
            <allow users="*" />
            <deny users="?" />
        </authorization>
    </system.web>
</location>
<location path="WebResource.axd">
    <system.web>
        <authorization>
            <allow users="*" />
            <deny users="?" />
        </authorization>
    </system.web>
</location>
<location path="SiteMap.ashx">
    <system.web>
        <authorization>
            <allow users="*" />
            <deny users="?" />
        </authorization>
    </system.web>
</location>
<system.codedom>
    <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
            <providerOption name="CompilerVersion" value="v3.5" />
            <providerOption name="WarnAsError" value="false" /></compiler>
        <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
            <providerOption name="CompilerVersion" value="v3.5" />
            <providerOption name="OptionInfer" value="true" />
            <providerOption name="WarnAsError" value="false" /></compiler></compilers></system.codedom>
<runtime>
    <assemblyBinding 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></configuration>

Everything was working fine until I added this code to the main app's web.config, in order to solve a problem with json:

<system.web.extensions>
 <scripting>
  <webServices>
    <jsonSerialization maxJsonLength="50000000"/>
  </webServices>
 </scripting>
</system.web.extensions>

Then when I navigate to any page within the 2.0 app, I get the following error:

500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.

Everything works fine with the 4.0 app, the error appears only with the 2.0 app. Another interesting thing is that, after the modification, if I try to access any IIS option of the 2.0 app, the following error appears:

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

Any idea to solve this problem?

Fran
  • 159
  • 2
  • 15
  • Please check this http://stackoverflow.com/questions/20063861/the-configuration-section-system-web-extensions-cannot-be-read-because-it-is-m – Krish Jul 01 '16 at 10:29
  • Hi Krish, I have checked all the suggestions of this entrie and nothing worked. – Fran Jul 04 '16 at 09:56
  • Hi @Francesc, Please check the below solution – Krish Jul 04 '16 at 11:04

1 Answers1

1

Try this in your web.config

<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
            <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
        </sectionGroup>
    </sectionGroup>
</sectionGroup>

Krish
  • 376
  • 1
  • 10