Deployment problems with ASP.NET AJAX applications

Published Fri, Oct 26 2007 14:55

In the last days I've seen several guys reporting problems while deploying ASP.NET AJAX applications to servers which only have  ASP.NET 2.0 + ASP.NET AJAX 1 installed. Generally, the error that has been reported is:

Could not load file or assembly 'System.Web.Extensions, Version=3.5.0.0...

One of the suggestions that I have seen is to add a redirect on the web.config app so that all requests made to the 3.0 dll are redirected to the 1.0 version of the dll. Even though most guys said that this worked, I didn't though it was the correct thing to do since I was positive that if you specify the correct version of the ASP.NET Ajax dll on the config file and that file existed on the server then you should get that file and not the most recent version.

Today, I've  finally managed to get a repro web app from Johnson (thanks!).Since this kind of thing will only happen if you have the .Net 3.5 framework installed, I started by looking at the web.config file. I though that VS might have changed the dll version silently, but no, that was not the case. Then I asked Johnson how he was deploying the app and he told me that he was publishing the app from within the VS. Since I'm running VS 2008 standard, I don't have that option here. So I asked him to publish the site and sent it to me by mail. This was really a simple site that only had one page with an UpdatePanel (or something simple like that)

After looking at the pre-compiled version, the problem was obvious: the assembly that was placed inside the /bin folder (built automatically  when you publish the web app form within VS ) had a dependency on the 3.5 version of the System.Web.Extensions assembly!

The moral of the story is simple: if you're using VS 2008 and you want to build a 1.0 ASP.NET AJAX web app to deploy on a server which is running version 2.0, then don't forget to set up the version you're compiling against on the property pages of the web project. This is specially true when you're using the publish option, since it'll pre-compile the web app and this will create dependencies between the resulting dlls and the platform dlls (which might not be installed on the server where you're deploying the app).

You should also pay attention to external dlls that are added to your project. For instance, if you're using the AJAX Toolkit, then you should check its dependencies and make sure that it was built against the correct version of System.Web.Extensions.dll.

Filed under: ,

Comments

# dashda » Blog Archiv » Deployment problems with ASP.NET AJAX applications said on Friday, October 26, 2007 9:45 PM

Pingback from  dashda  » Blog Archiv   » Deployment problems with ASP.NET AJAX applications

# RodeoFive » Deployment problems with ASP.NET AJAX applications said on Monday, November 19, 2007 12:32 AM

Pingback from  RodeoFive » Deployment problems with ASP.NET AJAX applications

# Trevor said on Monday, December 17, 2007 3:21 PM

Thanks for identifying the cause of the problem, but I don't understand how to fix.  Using VS2005, what do I need to do in property pages?  I used to have my app running but since i installed VS2008 it doesn't work when I publish to server.

# luisabreu said on Monday, December 17, 2007 4:38 PM

hello.

in this case the problem was that the web app is configured to user .net 2.0 but the ajax toolkit dll taht was copied into the bin folder was compiled against the 3.5 version....

# Sandhu said on Thursday, May 15, 2008 10:28 AM

Hi,

I read your page, its really good. I also had the same problem. Mine solved by deleting the line

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

   Namespace="System.Web.UI" TagPrefix="asp" %>

Then I changed it to

<%@ Register Assembly="System.Web.Extensions, Version=2.0.50727.1433, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

   Namespace="System.Web.UI" TagPrefix="asp" %>

But I still receive the same error so finally I deleted this. Now Ajax and the page , both are working fine.

# sarah said on Friday, January 30, 2009 6:50 AM

Hi! I'm getting the error even though the version in the property pages is correct. here's what I have:

AjaxControlToolkit BIN AutoUpdate

AJAXExtensionsToolbox BIN 1.0.61025.0

Please help.. thanks in advance :)

# luisabreu said on Friday, January 30, 2009 8:19 AM

if i recall correctly, the problem are the dependencies. In this example, what was happening was the sitee was being built against .NET 3.5 on VS and published on a machine  which only had .NET 2..0 installed. Have you checked that this is not happening with you?

# John said on Monday, June 22, 2009 11:59 PM

I have a similar problem. I have VS 2008 and The 3.5 Version of the control toolkit. I've been asked to work on a website that was built in 2005 using the older toolkit. I obviously can't add the 3.5 toolkit to the site and when I try to build it, it says it can't find the 1.0.61025.0 version... Can I have both toolkits installed?

Thank in advance...

Leave a Comment

(required) 
(required) 
(optional)
(required)