Saturday, March 24, 2012

AJAX and Vista -

I just upgraded to Vista from XP where I had IIS running very happily and AJAX installed and working great.

After upgrading to Vista I get this browser error on any AJAX website:

'Sys' is undefined

I remember seeing that error months ago back when it was called Atlas. But now that I'm running the latest OS, with a non-beta AJAX, why should I be getting this now? The upgrade to Vista has been painful all around, but I've managed to fix or find workarounds for most problems except this one.

It seems like the AJAX stuff isn't getting included into the webpage. I even tried creating a fresh project in VWD and specifying to use the VS template for "ASP.Net Ajax Enabled Website" and throwing together a simple page with an updatepanel and a command button. Same error.

I've run Windows Update and gotten all the updates, including the Visual Studio update that tells you to run VWD "as an administrator", which I'm doing.

The line in the generated page that it is complaining about is the first reference to Sys below.
Hopefully there is just some simple security setting in this locked down OS I don't know about to allow this to run? 
<script type="text/javascript">//<![CDATA[Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1'], [], [], 90);//]]>
</script>

Do you have following entry in your web.confg file?

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

Also, follow Readme notes on migration issues on ajax.asp.net .


Yes, I have that. This was a functioning ASP.Net 2.0/AJAX 1.0 application when I had XP, but now that I'm running windows Vista, it doesn't work.

I did have to manually edit applicationHost.config in C:\windows\system32\inetsrv\config to add entries for ASP.Net 2.0 (it only had enties for 1.1), so I'm wondering if something must be added there to support AJAX.

I tried downloading and re-installing AJAX, rebooting, all the obvious stuff with no luck. Upgrading to Windows has ALMOST completely shut me down from developing.

I did just discover that when I use the VWD built in web server, AJAX works fine. So AJAX is "installed" correctly on my PC. But as far as when I use the full-blown IIS web server, AJAX is dead.

I didn't see anything in the README relating to Vista migration, only migration from previous versions of Ajax/Atlas, which is not what I'm doing.


Here is what I ended up doing as I spent nearly two days trying to rebuild my Dev machine after purchasing a Vista capable laptop.

1. Mark your site in IIS7 as an Application (The choice is there if you right click on virtual IIS7 entry in the expanded list under websites...

2. Make sure that you have included all of the IIS7 web.config entries:

<

system.web.extensions>

<

scripting>

<

webServices>

<!--

Uncomment this line to customize maxJsonLength and add a custom converter-->

<!--

<jsonSerialization maxJsonLength="500">

<converters>

<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>

</converters>

</jsonSerialization>

-->

<!--

Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate.-->

<

authenticationServiceenabled="true"requireSSL="false" />

<!--

Uncomment these lines to enable the profile service. To allow profile properties to be retrieved

and modified in Atlas applications, you need to add each property name to the setProperties and

getProperties attributes.

-->

<!--

<profileService enabled="true"

setProperties="propertyname1,propertyname2"

getProperties="propertyname1,propertyname2" />

-->

</

webServices>

</

scripting>

</

system.web.extensions>

<

system.webServer>

<

validationvalidateIntegratedModeConfiguration="false"/>

<

modules>

<

addname="ScriptModule"preCondition="integratedMode"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</

modules>

<

handlers>

<

removename="WebServiceHandlerFactory-Integrated"/>

<

addname="ScriptHandlerFactory"verb="*"path="*.asmx"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addname="ScriptHandlerFactoryAppServices"verb="*"path="*_AppService.axd"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

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

</

handlers>

</

system.webServer>

Note that the PipeLine extension for the configured site can be set for Integrated (default) instead of the Classic Mode.

With those two steps I was able to get a XP configured site migrated over with Ajax...


My web site is set up as an application, and it uses an application pool set up for ASP.net 2.0.

When I set that application pool to use to use the Integrated mode, I can no longer even load my website (gives 404 error).

This is crazy, this was a perfectly functioning website under XP, and "upgrading" to vista has broken it.

Is there anything in the applicationHost.config file that needs to reference AJAX? I'm at the end of my rope here, I'm about to just install XP and loose ALL my programs and setting just to get back to a usable machine!

No comments:

Post a Comment