views:

134

answers:

3

Hi Guys,

So we've upgraded our site from 3.5 SP1 -> .NET 4.

When we ran the site, we got an Internal Server Error (500), stating the following configuration group could not be read:

<system.web.extensions>
        <scripting>
            <scriptResourceHandler enableCompression="true" enableCaching="true" />
            <webServices>
                <jsonSerialization maxJsonLength="999999" />
            </webServices>
        </scripting>
    </system.web.extensions>

We commented out this section and the website ran fine (but now we are getting problems with JSON - because of the above required property).

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.

I've also read threads saying IIS is somehow reading an old machine.config file.

With .NET 4, as you know a lot of the sections of web.config have been moved to machine.config.

So we put this section back in the top of the web.config:

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

And the website now seems to work ok.

Still, im a little concerned if this is the correct solution.

Any ideas people? Is this the correct fix?

EDIT:

3 weeks and no answers...damn. =)

A: 

As i've had no answers, and extensive googling resulted in no love either, i've decided to stick my original fix (adding the system.web.extensions section back into the web.config).

RPM1984
A: 

I have the same problem, and the same workaround fixes my application as well. But this seems bad to me because .NET 4 is supposed to have these sections defined in machine.config (and they are), but IIS is ignoring them for some reason...

Paul Shippy
Yep, its a mystery (maybe even a bug!). I'm not sure if its even IIS at fault, its almost like "old" machine.config files are being picked up. Maybe the CLR is doing something wrong, who knows. This temp fix has become a perm fix until i find a better solution.
RPM1984
A: 

Two more bits of info that may or may not help.

  1. the only difference from the above sectionGroup and my machine sectionGroup is the version=3.5.0.0 here and version=4.0.0.0 in the machine.config. 1.
  2. The error in the event log is "Could not load all ISAPI filters for site..." Could there be an install of System.Web.Extensions that is not registered properly with .net 4?

I'd love to test more on this, but unfortunately I only see this behavior in a production system and not a dev system.

ctc