Saturday, October 20, 2007

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.
There are a couple catches to consider with running multiple versions of the framework side by side.

Worker Process is the one that hosts a particular framework version. 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 IIS.
aspnet_wp.exe is the worker process with IIS 5, w3wp.exe is the worker process with IIS 6.
IIS 6 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.
With IIS 6 there is one problem:
You cannot run more than one version of the framework in the same application pool in IIS 6.
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.
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 very easy.
Simply create a new application pool and move the site that you will be upgrading to that pool.
So basically you can group all the sites to a different application pool which is all specific to framework version and windows user credential.

Ref: Understanding Application Pooling in IIS 6.0

No comments: