Scott Forsyth's Blog

Postings on IIS, ASP.NET, SQL Server, Webfarms and general system admin.

Cloud Resources

IIS Resources

Running multiple versions of the Framework in ASP.NET

Like any good technology, ASP.NET continues to evolve as new versions are released.  But, like anything else, this brings with it a number of considerations.

Microsoft has done a great job of allowing multiple versions of the framework to run side by side.  Version v1.0, v1.1 and v2.0 can all run together at the same time on the same server.  Each site, or even a vdir (Virtual Directory) within a site can have its own version of the framework installed.  Simply install the framework version on your server and it will be available to you.  The install itself is quite small, for example the v2.0 download is 22MB.

The Microsoft homepage for the .NET Framework is:
http://msdn.microsoft.com/netframework/downloads/updates/default.aspx

There are a couple gotchas to consider with running multiple versions of the framework side by side.  First, let's dig into IIS a bit.  Following is a snapshot of Windows Task Manager on an IIS5 (Windows 2000) server:

aspnet_wp.exe_iis5 

Notice the 3 processes called aspnet_wp.exe.  There is one per version of the framework. (v1.0, v1.1 and v2.0)  If a process for a particular version of the framework doesn't exist, as soon as it's needed, a new process will be spun up.  This allows multiple versions of the framework to live beside each other in IIS5.  No effort, no pain . . . it just works.

Now consider the following IIS6 (Windows Server 2003) screenshot:
w3wp.exe_iis6 


Notice that there aren't any aspnet_wp.exe processes anymore, but there are w3wp.exe processes instead.  IIS6 was an impressive upgrade that brought with it some new concepts.  One key new concept is Application Pools.  A system administrator is able to create groups of sites and place each site in its own group.  Whenever a site needs to run, a w3wp.exe process will start for its application pool if it hasn't already started.  This brings with it a number of welcome security, performance and management advantages.  You are now able to specify your own Identity User which can be unique per Application Pool.

In IIS6, the aspnet_wp.exe process is done away with, and the work that it did is now done within each w3wp.exe process.  This has the same advantages I mentioned previously, but it has one big gotcha! 

You cannot run more than one version of the framework in the same application pool in IIS6.

While multiple versions of the framework can co-exist on the same server, they can't co-exist in the same process.  If you attempt to run multiple versions of the framework at the same time in the same process, the 2nd version that tries to run will fail with the following error:

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.

You will also receive Event ID 1062 in Event Viewer that says:

"It is not possible to run two different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process."

What to do

Fortunately, the solution is easy enough.  Simply create a new application pool and move the site that you will be upgrading to that pool.  You can even base it off of the existing one if you don't have the password memorized for the existing one.  This is all done within IIS.  Once you have placed the site or vdir in its own application pool, then you are ready to upgrade to the new framework version.

I'll cover the different ways to move between different versions of the framework in another blog within the next few days, but the key thing to walk away with now is that multiple versions of the framework cannot co-exist in the same worker process at the same time.  IIS5 didn't have any issue with this, but IIS6 requires that each version be in its own app pool.

Comments

Ohad Israeli said:

Another problem you might get is the fusion process... if you are calling managed code from unmanaged process your managed process will be loaded with the latest version of the clr. you can add app.config to the unmanaged process where you'll declare the target version or use hosting clr api to direct to specific version of the clr but there are cases where this solution is just not enough.
# January 26, 2006 6:40 PM

Ryan Mrachek said:

Question: What considerations do you have to make to run a 1.1 application in a 2.0 site and how would you work security from the root?
The reason is that typically we run a few applications off the root, I've upgraded the root however since I previously taken off IsolateApps in 1.1 to share the authentication throughout the site the 1.1 application now sees the 2.0 web.config and blows up.
Suggestions?
# February 22, 2006 6:32 AM

Yaheya Quazi said:

We have a new issue which I think I have not found by searching the net as of yet. The issue is, if you run a dot net 2 app in the root of your web site such as (www.yourdomain.com) you can not have virtual directories that uses 1.1 version of the dot net framework. The other scenario works though where the root site uses 1.1 but the virtual directory uses 2.0. Is this by design? Can someone help please??

# September 12, 2006 4:21 PM

Syed Raheel Noor said:

The article is great and to the point.

I have solved my problem after reading this article

Thanks Scott

Regards

Raheel

# September 14, 2006 1:37 AM

Leran said:

Yes, it helped me solving the problems. thanks.

# October 27, 2006 11:18 AM

Peter Larsen said:

This article (and the fact that I could find it on Google using the error message from Event Viewer) took me from absolutely clueless to problem solved in 15 minutes. Thanks!

# November 13, 2006 12:04 PM

Ravi said:

The article is good, it helped me to better understanding different versions of IIS...

Thanks a lot

# November 13, 2006 1:57 PM

Azola said:

Hi

I have 3 web applications, and all of them are .Net2. I created an Application Pool called Net2AppPool. Only 1 of them works. The other 2 give me the error:

"It is not possible to run two different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process."

# November 14, 2006 6:39 AM

Ian Wermerling said:

I am trying to convince our company to move from 1.1 to 2.0.  Unfortnuately the guy in charge of the production server has it in his head that running multiple versions of the framework on a server will have a major performance hit on the server and it would put alot more stress on the actual server.

Is there any truth in this?

# November 24, 2006 5:53 AM

Travis Butcher said:

Thanks for the great little article.  I was not able to get my sites working properly until this.

# December 29, 2006 3:37 PM

Aref said:

I have created a new app pool and moved the application there. but I have still the error. event 1062

# January 6, 2007 1:21 AM

Tex said:

Worked fine for me... Thanks.

# January 11, 2007 7:33 AM

Juls said:

Thanks for this little tid-bit.  Worked awesome!

# January 13, 2007 12:44 PM

Chris said:

i created a new app pool for my 2.0 and THEN right-click app pool and Properties and Identity tab, then set the security account the same as my 1.1 - this solved all of my problems! (thanks, Alka!)

# January 24, 2007 10:56 AM

Joe said:

First off let me tell you I'm not experienced with IIS.  The most advanced thing I have done with it is an iisreset.  My problem deals specifically with a Windows 2003 Small Business Server and it seems to only affect 1  thing - Trying to download the Connection Manager from the Remote Web Workplace.

All of the Web Sites on this server are using ASP.NET 2.0 except for 1 - exchange-oma.  It appears that I have the ability to simply make it use version 2.0.  What could go wrong if I try to change it?

# January 24, 2007 2:59 PM

Kim Stroh said:

We have a 1.1 web site that was using SQL 2000 Reporting Services. We opened reporting using query params in a pop-up window. We upgraded to SQL 2005 and its version of Reporting Services (ASP.Net 2.0) and also upgraded our reports to VS2005. We now get this same error we sending in the url and trying to open the pop-up window. The vir dir for the main web site is 1.1 and the vir dirs for the reports and report server are 2.0. Is there a way to hit the new reporting services with ASP 1.1 code?

# January 24, 2007 4:35 PM

OWScott said:

Hi Ian,  Sorry for the long delay in replying.  I need to get the email notifications fixed so I can see when I receive comments here.  

v1.1 and v2.0 will run beside each other without any noticeable performance penalty.  There would be a slight performance penalty if you break a site into parts since there will be more AppDomains around which pre-load necessary .NET information.  But that would be negligible.  Multiple versions co-exist very well together.

# January 25, 2007 4:58 PM

OWScott said:

Hi Joe, just make sure to place it in its own app pool before doing the change.  Once you change it, you can put multiple sites in the same app pool, but you don't need to.  There is some memory overhead with each app pool but if you don't have many, and your RAM is good, leaving it in a separate app pool is probably best anyway.

Also, take note that using the ASPNET tab causes an AppDomain recycle on *all* sites on the server, even if you are just changing it for one site.  So be careful not to change it using that on a production server during prime time.

# January 25, 2007 5:01 PM

OWScott said:

Hi Kim,

SSRS sets up multiple virtual directories.  Setting up app pools is easy, so the best bet is to create a v1.1 app pool and v2.0 app pool.  Then just move your sites to the appropriate vdir.  

I haven't tested SSRS 2000 on v2.0 but my guess is that it would work.  You may be able to get away with upgrading all of your sites to v2.0, and then you don't need to worry about all about them fighting with each other.

# January 25, 2007 5:06 PM

David said:

What would the command be from the command prompt to change a sites ASP version from 1 to 2 or vice versa.  Would you use aspnet_regiis.exe -i (something goes here)?

# February 10, 2007 2:11 PM

Veeru said:

Thanks for the great little article.  I was not able to get my sites working properly until this.

# February 14, 2007 9:35 AM

HelenG said:

To say that running multiple versions will 'create a major performance hit on the server' is a huge  understatement. Our's was working just fine before, and now it slowed down to a crawl. And we are getting these error messages intermittanly. yak.

# February 15, 2007 2:29 PM

Rob said:

What about when you want 1.1 code to use a 2.0 component that is installed in the GAC?  How would you go about setting that up?

# March 13, 2007 7:48 PM

Ajay Goel said:

But can't Microsoft do the changes in IIS6 so that it cud also allow different versions of the framework to be  run at the same time in the same process??

# March 20, 2007 8:26 AM

radeis said:

Surya, I've been having the same issue on a hosted platform.  Even if i run separate app pools, i still get the same 403: Access denied.  Anyone have any thoughts on this?

Regards,

CJ

# March 25, 2007 10:39 PM

Jason Kelley said:

Check to make sure that both app pools are not using the same IP address.

# April 20, 2007 3:46 PM

Bjorn Tipling said:

Hi,

This article helped me! Thanks. The screenshots of the task manager were really helpful.

# May 7, 2007 1:14 PM

Monty said:

> I'll cover the different ways to move between

> different versions of the framework in another

> blog within the next few days

Cool, can't wait!  ;-)

# May 31, 2007 5:57 AM

Anas Bahsas said:

thanks scott I have solved my problem , my home directory using 1.1 and childs using 2.0 , but I have added new application pool for 2.0 vdir

# July 8, 2007 5:24 AM

adb said:

folks,

this is urgent

after doing all of this if try to browse to the url i get 404 resource not found.

what i am missing

# August 3, 2007 9:19 AM

OWScott said:

Well, I'm a few months late replying to some of these, but I'll give a quick reply now for anyone that happens to be reading the thread and comments.  Thanks to everyone that already answered some of the questions.

David: It's the -s command that you're looking for: aspnet_regiis.exe -s W3SVC/1/ROOT/SampleApp1.  The 1 needs to be replaced with the siteID.  The /SampleApp1 can be left off if you're setting the framework version for the whole site.  You can also do the same using the ASPNET tab, but understand that either aspnet_regiis and the ASPNET tab will cause appdomain recycles for the entire server!  So don't run this during prime time on a production box.  

That leads to my second comment, Monty I still need to write my blog post on the ASPNET tab.  I obviously didn't hit my deadline for that.  I'm trying to decide if I should clean up an internal script and make it public.  I'll be sure to get to this fairly soon.

Rob, I'm pretty sure that a v1.1 site can't run a v2.0 app that's in the GAC.  You'll probably need to upgrade your app to v2.0 for it to work.  The vast majority of v1.1 sites will run under v2.0 without any changes though, so give that a try and see if an upgrade works for you.  

Ajay Goel, I'm sure they can if they really tried, but the work to get multiple versions of the framework to load within the same worker process and play nice together is extensive.  It's probably cleaner all around to do it this way.  IIS 7 is cleaner yet.  You set the framework version at the app pool level rather than the application level, so it ensures that you'll never mess this up.

Surya Prakash, your error isn't caused by the framework mismatch, it's something else.  A 403 error can be from a large number of things, for example no default doc or not execute permission granted on the folder.  I suspect you've solved this months ago so I won't go into detail on this one now.

Tal, my best guess on yours is that you're using a different type of bit encryption level, or maybe a browser setting is not allowing you to view the page unless the domain name matches the cert, or some images or referenced objects in your page are referencing http:// without the https.

Adb, a common cause for a 404 error is if you are using a different file extension that isn't set as a valid MIME type of a file extension.  IIS6 will throw a 404 for that.  As a test, rename the file to a common extension like aspx and see if it works.  Or, the more obvious error is that the file doesn't exist.  :)

# September 6, 2007 12:50 AM

RXJ said:

You know, as old as this post is, it helped me today. Thanks for keeping it in your archives for people to refer to.

# March 8, 2011 12:01 PM

OWScott said:

Thanks RXJ!  It's great to have feedback on the old posts.  This is still applicable for IIS6.

# March 8, 2011 12:15 PM

Naveen said:

Yes ...This is really helped ..Explanation is Good.

# May 17, 2011 3:56 AM

om said:

Was getting #1062 and resolved creating a new AppPool and assigning it to my site. Thanks your post helped.

# June 1, 2011 7:39 PM

allenreyes said:

Still relevant and solved my issue with IIS 6. Thanks.

# July 8, 2011 12:30 PM

Shaul B said:

Thank you for this excellent information!  I was going crazy - you must have saved me days of work with this blog!

Thanks again

# July 11, 2011 10:50 AM

haz said:

Awesome...thanks for this info...very clear and descriptive

# September 21, 2011 8:15 PM

Charles said:

Thanks, we got this error and checked our app pools and sure thing we had overlooked one of our old .NET applications being in the same app pool as the new .NET version apps.

# October 13, 2011 2:47 PM

MikeB55 said:

I have a problem running an MVC application in my production server. My default website is running ASP.NET 2.0 and it's using the DefaultAppPool.

After reading this article, I followed the instruction and created a new application pool. I also created a new website in IIS and created a Virtual Directory for my application. So my new website uses port 81 and the Virtual Directory for my MVC app uses the new application pool.

To me it seems that everything should be separate now. The new MVC app should spin up a new w3wp.exe process that uses ASP.NET 4.0. The other applications running under the default website should create a process that uses ASP.NET 2.0.

Unfortunately this is not the case. I keep on getting the 1062 error:

It is not possible to run two different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process.

I tried restarting my server a number of times. This error doesn't always happen. For example, last week everything worked well for 1 day, then this morning (Monday) I got this error. All of my apps in the Default Website stop working and I see other errors in Event Viewer like EventID: 1309 with error:

Exception information: Exception type: WebException Exception message: The operation has timed out

Can anybody help with this? Thanks.

# January 16, 2012 7:50 AM

OWScott said:

Hi Mike,

It does sound like you're running into the same situation where two different apps are using the same app pool but using different framework versions.

You're on the right track.  There is probably another application which is fighting with the site.

The best way to track that down would be to go to the application pool (in IIS Manager) and view the applications on the right.  It should list more than one.  Double check each of them.  You can confirm the framework version using the aspnet tab, or you can go to the site or application and click on Home Directory/Configuration and find your .aspx extension (and confirm the other ones too).  They should be pointing to one version of the framework.  Ensure that all sites/apps in the same app pool are using the same framework version.  

It sounds like one of them is using a different framework version so it's a race as to which one is run first after a reboot or restart of IIS.

# January 16, 2012 9:15 AM

Nanju said:

Hi,

We have a MVC 3.0 app targeting framework 4.0 to be installed on IIS 6.0 on w2k3.

The deployment is on a virtual directory that has target framework 4.0. The virtual directory belongs to a parent site that has framework 2.0 configured and there are existing apps targetting 2.0 framework. Is this the recommended deployment model or should the site be setup exclusively for framework 4.0 ?

(Different fx are using diffrent App Pool).

On deploying the app we are consistently getting the 403 error using IE client. The IIS log is as below

2012-01-30 09:36:02 W3SVC1441322441 127.0.0.1 GET /TestMVC3App/ – 100 – 127.0.0.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.2;+SV1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.30;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+.NET4.0C;+.NET4.0E) 403 14 5

Installation steps followed were -

– Framework 4.0

– ran aspnet_regiis.exe with -ir (to retain 2.0)

– changed virtual directory property to target v4.0.30319

– added supportedFramework=”v4.0.30319″ in web.config

Please let me know anything is missed out while setting up the environment.

Also can you please le me know if we can have the Parent site and MVC3 app targetting 4.0 and rest of the apps which were targetting 2.0 will be left as it is?Is there any issue with this approach? - This approach is working fine for test sample applications.

Thanks in advance.

–Nanju

# January 30, 2012 8:52 AM

OWScott said:

Hi Nanju,

What you have is acceptable and can work.  There are some considerations:

- Need to consider inheritance for the web.config files.  v4.0 removes some config sections, so a typical v2.0 web.config will throw errors under v4.0.  In your v4.0 web.config file you'll need to <remove /> sections that are inherited, or you'll need to use inheritInChildApplications.  Here is an old blog post of mind on that: http://bit.ly/xO1tGq and a great new post from Jon Galloway on that: http://bit.ly/z9XyHf.

- For 403.14 errors just mean that the default doc isn't recognized.  You may need to add the framework as a wildcard mapping.  Here's a blog post that covers how to do that in IIS6: http://bit.ly/Axo8OQ.  And I'm sure there are better posts out there on MVC specifically.  The key thing is to add aspnet_isapi.dll as a wildcard mapping.

- you can have v4.0 in the root and v2.0 in a subfolders but you still have the same inheritance to fight with.

- so it may be easier if you can upgrade the root of the site to v4.0 too.  You may find that it's as easy to upgrading the app pool and removing the old web.config sections.  It may just work, and then you don't have to worry about maintaining v2.0 and v4.0 in the same site structure.  While fully possible and 'normal', it can take some extra work to get working.

# January 30, 2012 10:36 AM

Grant said:

Thanks, Scott!

Between the blog post and the comments afterward, I was able to solve my problem very quickly!

      -Grant

# May 22, 2012 4:28 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)