Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

A plea out to all those who are using ASP.NET AJAX with sites on IIS7, either under Vista or Longhorn Server:

I've been battling a strange issue with ASP.NET AJAX on IIS 7 running under Vista.  It's a site that was upgraded from RC1 to RTM, and works great under IIS 6.  Have troubleshot it enough under IIS 7 to determine that if the AppPool has the Managed Pipeline Mode set to "Integrated", it fails, and if it's set to "Classic", it works perfectly.  The error I'm getting is one that was common during the beta, the Javascript error "Sys is undefined".  This happens right after the <ScriptManager> element is parsed.

Of course I've checked all the standard things like making sure the System.Web.Extensions assembly is referenced, and adding this under httpHandlers:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

For awhile it seemed like it may be related to forms auth restricting access to the .axd script handlers, and this solution from Emad looked promising.  But after trying all manner of <location> elements in the web.config to designate the scripts to load, and even disabling forms auth altogether, it still didn't work.

It is a site that uses master pages, so there's all the good strangeness of Intellisense while developing in VS.  You have to have the master page open in order for Intellisense to properly show ASP.NET AJAX elements in the child page.  Perhaps the classic pipeline handles these master page scenarios properly, while the integrated pipeline does not.

I'm also wondering if this could be some kind of compression issue.  I know that IE 6.1 had issues reading compressed scripts unless you applied a hotfix, and would exhibit this problem.  But this comes up with both the patched IE6 and IE7.

I guess my next step will be to meticulously compare web.configs between a fresh project and this converted one.  Then if that doensn't help it will be time to break out with Fiddler and see exactly what's going across the wire.

Troubles aside, dang, ASP.NET AJAX sure is slick when it's working!

(Edit) AHA, a solution!

Turns out in the web.config nestled under <system.webServer> / <handlers>, I was missing this entry:

<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

Y'know, there are so danged many moving parts that can get in the way of rendering the scripts from a <ScriptManager>, I think when I have a moment I'll write up an article to help folks troubleshoot all of them.


Feedback

# AJAX fun with the dreaded 'sys is undefined' error

If you have started to play with AJAX then you have most likely come across the dreaded 'sys is undefined' 4/9/2007 4:24 PM | Is This Thing On?

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

This solution does not seem to work on child sites that are accessed as modules in a framed site. Any ideas would be greatly welcomed.

Thanks 5/30/2007 1:04 AM | Ramon Tristani

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

This worked for me.
<add verb="GET" path="ScriptResource.axd" type="Microsoft.Web.Handlers.ScriptResourceHandler" validate="false"/>

Try this link
http://blogs.msdn.com/mattgi/archive/2006/11/06/asp-net-ajax-beta-2-is-released.aspx
6/25/2007 7:14 PM | Tom

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

I just downloaded AJAX 1.0 today and installed it on my web server (WS2003 all current updates).

I still get the Sys is undefined error. My web app works in Visual Studio; but does not work when called outside of Visual Studio. I have tried all the suggestions I could Google in 4 hours including the ones above.

Does anyone have AJAX 1.0 working yet?

There must be a way to get it to work! 8/1/2007 2:36 PM | Arnold

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

Thanks man! I've been looking at this for a while before I came across your site. All of my AJAX was working until I switched to Vista and then all of a sudden it didn't work while I was trying to debug. I was missing the 'preCondition="integratedMode"' piece in my web.config. Put that little baby in there and voila! Everything works again!
Thanks! 8/23/2007 6:38 AM | Chris

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

I already have the above suggested line in web.config then also getting same error
11/30/2007 7:29 PM | Ramesh

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

Hi,
Getting syntax error when using import System; in javascript. I want to use the System.setClipboard function. How can I resolve this issue.. Urgent help is needed..

Thanking you 12/16/2007 7:32 PM | Muthu

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

1. I've installed window 2003 SE sp1 on my server
2. downloaded AJAX 1.0 with the Toolkit
3. Uploaded it to my server,
4. Within IIS I created an application under my website
5. get the same error.

i've been searching for HOURS and almost start to cry 1/10/2008 11:45 AM | Marcel Ruiter

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

I too had the same problem.fixed it.My system date was set to past.when i changed to current date,the problem was solved. 1/16/2008 2:30 PM | anu

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

I am about to give up on AJAX and Microsoft. WHAT THE HECK i have built a entire website with multiple pages and lots of fun ajax tool kit tools. BUT of course as always it works on my DEV box and not on any server i move it to. SO i said i will try to just create a simple ajax website that had a update panel and label and button, just like the examples all over the web. GUESS WHAT IT DOES NOT WORK. I GET THE SYS is UNDEFINED!!!!!! i have probably been threw every different combonation of webconfigs possiple and nothing works!!! Do i need to intall something on the server or what ? I am completly stuck and i am one day away from learning java and creating this entire app with out any AJAX and be very unhappy. THANK YOU SO MUCH ahead of time for your help 1/18/2008 4:26 AM | Mike

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

My web.config already has this, but unfortunately it still doesn't work. ANY help is appreciated. Also I'm working within a frameset. Any solutions for this scenario? 2/19/2008 7:02 AM | vkumar

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

We are using a policy manager to secure our site. When we removed the mapping, the error was gone but of course so was our security. We fought with this for days, I just noticed that the drive mapping for the Wildcard Application map was set to check if the file exists. This makes sense, because the file is on a local drive, but I suspect it's applying that check to the .axd file as well and we got the 'Sys undefined'. Now apparently all is well (hope I didn't speak too soon).

This is an II6 system, Win2K3. 3/9/2008 1:50 AM | Paul

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

Thank you!
I've been having some issues, now solved with the classic mode. What's the difference between the modes?

I've also changed in web.config and will now turn back to integrated mode. 3/18/2008 5:47 AM | Stefan Bergfeldt

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

My web.config already has this, but unfortunately it still doesn't work., could u plz update me for this...?
4/23/2008 7:45 PM | Chandrashekhar

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

For what it's worth, I was pulling my hair out trying to fix the sys not defined error. It turns out the whole error was connected to a back dated system date I had. Once I corrected my system date to the correct date, everything worked fine.

Go figure, thanks ANU!!! 6/22/2008 12:24 AM | Andrew

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

Thanks to Chris Riccio for this snippet whic worked for me.
http://weblogs.asp.net/chrisri/archive/2007/02/02/demystifying-sys-is-undefined.aspx

In the Web.config;
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="false" enableCaching="true" />
</scripting>
</system.web.extensions> 7/29/2008 5:22 PM | Rick

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

Thanks for the tip. I was struggling with this one. Your suggestion got me going again. 7/31/2008 8:28 AM | Scott Marlowe

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

None of these work. Isn't anybody an authority on this subject or is everyone simply hoping it works? 8/16/2008 9:32 AM | anon

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

Put this within your <system.web> nodes...

<httpHandlers>

<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>

</httpHandlers> 8/16/2008 9:39 AM | anon

# re: Resolving the "Sys is undefined" error in ASP.NET AJAX RTM under IIS 7

Tried everything listed and still doesn't work. Any other solutions? 8/19/2008 8:08 AM | anon

Post a comment





 

Please add 6 and 4 and type the answer here:

News


Welcome to my blog.
Here's what we've got on the menu today:

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

Syndication: