Friday, December 22, 2006

Running .NET 1.1 and 2.0 web applications simultaneously

When I first started running .NET 2.0 web applications on my server, I would get errors in both 1.1 and 2.0 applications about every 10 minutes. For some reason my DefaultAppPool was getting shut down and I would have to restart it. After it happened a few times I figured there was something really wrong. I did some research and found that you cannot run 1.1 and 2.0 applications in the same application pool which, by default, is how IIS configures your applications. To fix this, follow these steps:

  1. Create a new application pool:

    Right click on Application Pools and go to New > Application Pool.



    Name it "DotNet2" or something like that, and click OK. You will see it added to your list of application pools.

  2. Tell your application to use the appropriate application pool:

    Right click on your application and go to Properties. Switch to the Home Directory tab. At the bottom should be your Application Name. If this section is disabled then click the button to create a new application. Give it an easily identifiable name. The box at the very bottom will allow you to choose your application pool. Select DotNet2, or whatever you had named it in step 1.



  3. Tell IIS to use ASP.NET 2.0:

    Switch to the ASP.NET Tab. For the version use the drop down box to select 2.0.xxx.




That's it! You can leave your 1.1 applications running in the DefaultAppPool and they will be fine.
 

2 comments:

Lucas Stark said...

You can also use the application pools to configure the user that the specific application will run as. So if you need to give one application access to a specific DB, or set of DB's you can create a user that has access to those DB's and run the application pool as that user. The application can then use Integrated security and will only have access to the correct DB's.

Anonymous said...

Ran into this problem when upgrading an existing VS2003 solution (on Win2003 to VS2008.

I may be a little slow here, but it seems that it's the applications and websites that determines whether they run in 1.1 or 2.0 mode, not the application pools. I'm sure the app pool gets confused if required to run both simultaneously (?), but if it's impossible to run both in one app pool, how come the app pools aren't in charge of the ASP.net setting ?
Cheers.