Take the 2-minute tour ×

Using IIS 6, is Application Isolation happen based on the Application Pool? If so, what happens when there is more than one Virtual Directory in one Application Pool? Do they all share the same memory and if one Virtual Directory crashes, all the other apps crash as well?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

If functionality in one Virtual Directory crashes, yes, it may crash or harm other applications in the same Application Pool, including those in other Virtual Directories. Protect your applications by putting them into separate Application Pools.

Virtual directories do not themselves segregate memory or resources. This has other implications as well. For example, your static variables in one application can be affected by setting static variables in another application in the same application pool.

In IIS 6, the point of an application pool is quite simple: to segregate applications so that one crashing does not bring down the rest. In IIS 7, that is still the main purpose, but there is a little more to it.

Edit: To clarify: Each Application Pool is it's own "worker process", and one crashing won't hurt other Application Pools. Each Virtual Directory is simply that: a way to make IIS act as if there was a directory at that place. When you create a Virtual Directory with the same name and location as the folder it points to, by default that doesn't really do anything. You can use virtual directories for a variety of reasons, in addition to making URL's be as you wish: You can use them for security. And you can use them to put calls into particular application pools, as we've been discussing.

People often equate Virtual Directories with Web Applications because that is usually where you want to use the configuring power of virtual directories--by web app.

Session State is only maintained within the Web Application, not amongst all the Web Applications in an Application Pool. To store values shared between different Web Applications, you'd have to do something else. The ASP.NET cache, cookies, db, etc. Putting different folders in your application as different Virtual Directories and Separate Application pools would put them in different processes and destroy their shared session state.

share|improve this answer
If a recycle happens, does that mean it is done at the Application Pool level so all virtual directories in that app pool are restarted? –  user31673 May 19 '10 at 15:10
@user54064: yes, that is correct. –  Patrick Karcher May 19 '10 at 15:32
Does the sharing of session state happen at the virtual directory level or the App Pool level? –  user31673 May 19 '10 at 15:47
As Chris Lively mentioned, it happens at the Application Pool level. –  Patrick Karcher May 19 '10 at 15:54
So that is how you could share session state across multiple ASP.NET applications by putting them all in the same virtual directory? I didn't know that was possible. –  user31673 May 19 '10 at 15:57
show 4 more comments

Different virtual directories can have different application pools. If they share the same app pool and blow up then the whole app crashes. If you have different app pools configured for the virtual directories then they are isolated.

Bear in mind that setting up different app pools for your virtual directories has other consequences such as the lack of ability to share in memory session state. In this case you have to use out-of-process storage.

share|improve this answer
add comment

Your Answer


