简体   繁体   中英

ScriptResource.axd and .Net 4

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. eg 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!!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM