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 App开发者_如何学JAVAlication Pool? Do they all share the same memory and if one Virtual Directory crashes, all the other apps crash as well?
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.
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.
精彩评论