Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScriptResource.axd and .Net 4

Tags:

ajax

asp.net

We have just converted our website to run on .NET 4 and upgraded our server (Web Server 2008 SP2 IIS7.0) to run the .NET 4 framework. Our site now displays the following problem on 50% of all computers that try to access it whereas the other 50% work perfectly. All worked fine under .NET 3.5

Sys.WebForms.PageRequestManagerServerErrorException: The requested name is valid, but no data of the requested type was found. ScriptResource.axd Code:0 Line:5 Char:89043

Our web.config has the following defined:

<system.webServer>
  <validation validateIntegratedModeConfiguration="false" />
  <directoryBrowse enabled="true" />
  <modules>
   <remove name="ScriptModule"/>
   <add name="ASPxHttpHandlerModule" type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v10.1, Version=10.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
   <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="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>
 </system.webServer>

The site runs with an Application Pool defined as:

.NET Framework Version: v4.0
Managed Pipeline Mode: Integrated

We switched the site to download the Ajax scripts from the MS Content delivery Network (ScriptManager EnableCdn="True") and still had the same problem except this time we get the problem occurring in:

MicrosoftAkaxWebForms.debug.js Line: 868 Char:13

Have removed all our own scripts and the Ajax Control Toolkit to no avail. What is mystifying is that it works ok on 50% of machines and not on the other 50%. There is no commonality between the works/not works. Different o/s different browser mixes. e.g. works fine on one machine Win 7 / IE8 fails on one machine same o/s and browser...works fine on one machine XP Firefox3 fails on another same config.

Any help greatly appreciated (getting desperate!!)

Lastest update:

We reverted the site to .Net 3.5 without changing any code on the site and all works perfectly. Guess we will stick at 3.5 for the foreseeable future!!

like image 283
iceyp Avatar asked Nov 05 '22 10:11

iceyp


1 Answers

Dont give up just yet, had a few headaches when I upgraded our site to 4.0 but nothing a few hours of hair pulling didnt resolve!

Looking at your web.config...

       <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

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

These modules are still referencing the old 3.5 libraries. Update your references to point at the new 4.0 versions of these libaries.

Please also look into the changes which have been made in 4.0 to minimise web.config settings. One way to get started would be to create a new 4.0 website work out what you need to add to the web.config to get up and running.

I'm using the AJAX control toolkit on our 4.0 sites and I dont have any of the handlers you have registered and I dont belive you need any of them (apart from maybe
the DevExpress one).

Ta

Steve

like image 173
CountZero Avatar answered Nov 15 '22 12:11

CountZero