S h o r t S t o r i e s

// Tales from software development

Running multiple versions of .NET in IIS 6.0

leave a comment »

I run a private but publicly accessible web site that I wrote about four years ago that provides me with access to a webcam set up in my home and various other services such as webmail. It’s run without a glitch for years and then today it stopped working. Whenever I tried to access it I got this message in my browser:

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.

I checked the event log and found this error:

Source: ASP.NET 1.1.4322.0
EventID: 1062
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 puzzled me was that I couldn’t understand why the problem was occuring now – I’d been using the web site regularly over the past few weeks without any problems and I hadn’t changed anything recently. What had changed to cause the problem ?

The last thing I’d done on the machine that hosts the web site was to install a new web service that reports on the status of the machine – free disk space, etc. The web service is written in .NET 2.0, so presumably this was what the message was referring to – IIS was objecting to an attempt to run two different versions of the .NET CLR in the same process. However, I’d written and installed that service about three weeks ago so why didn’t the problem show up then ?

I typically only use the web site when I’m not at home, usually when I’m at work. The only application that uses the web service is an application that runs on my desktop computer at home to show me the status of my servers. So, requests against the web site and the web service were never being made at the same time. What was different about today was that I was at home using my desktop computer (with the application that calls the web service) and I’d tried to login to the web site.

Presumably, both processes were also being unloaded after a period of inactivity so I’d even managed to use both the web site and the web service within hours of each other over the past three weeks without problems. It was only when I tried to use both at the same time or within a short period of each other that the conflicting .NET runtimes became an issue.

The solution was simple enough. Both the web site and the web service used the DefaultAppPool and so were running in the same process. So, I created a new AppPool based on the DefaultAppPool with a suitable name and then configured the web site to use the new AppPool. It’s simple enough but worth documenting:

First, create the new AppPool:

1. Start the IIS Manager using Start | Administrator Tools | Internet Information (IIS) Manager

2. Expand the local computer and the Application Pools folders.

3. Right-click the Application Pools folder and select New | Application Pool…

4. Enter the name of your new application pool, select the option to Use existing application pool as template, and select DefaultAppPool in the drop down list.

5. Click OK.

Now set the web site to use the new AppPool:

6. Expand the web sites folder and select the web site where your web site is located (e.g. Default Web Site).

7. Right click on the folder for your web site and select Properties.

8. Select your newly created AppPool in the Application Pool drop down list and click OK.

If you tend to use the DefaultAppPool for your web applications and you want to run multiple versions of .NET then you might want to create a default AppPool for each version of .NET that you intend to run.

Written by Sea Monkey

April 11, 2008 at 4:43 pm

Posted in Deployment

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: