IIS expert Scott Forsyth has been running a
video lesson series where he shares best practices, technical processes, tools of the trade, and occasional stories from working in the trenches. 25 of the planned 52 weekly, roughly 10 minute sessions are hosted on YouTube and currently available for free viewing. I checked out the "AppDomain - What it is and Why it's Important" & "IIS Virtual Directory vs. Application" sessions & found them very informative. I've jotted down some material from there & I'll add more as I finish watching the rest -
* When to use Virtual Directory vs Application -
- Use Virtual Directory when you want to point to a different physical path, when you want to share a physical folder across sites.
+ Use Application when you want:
- New application root or
- AppDomain isolation or
- Subfolder to be in new application pool (2 folders of same site targetting different .NET Framework versions can be set to different app pools)
- A vDir pointing to a single physical path can be shared by 2 sites. While accessing files under that shared folder, it appears as if this vDir appears physically under it.
+ 4 types of IIS Folders (note the icons in the image)
- Normal Folder
- Application Folder - use "Convert to Application" in the context menu. Lets you change Application pool but not physical path
- vDir only Folder - shares same app domain & app pool as root site
- vDir with Application - vDir with seperate application boundary
- On removing an Application, physical path remains but references are lost.
- AppDomains are a boundary set up by ASP.NET; they are controlled by IIS
- Usually there is a 1:1 mapping between app & app pool
+ AppDomain recycle consequences -
- First hit perf penalty when
- Any info in that appdomain (like inproc sessions) is lost
+ AppDomain Recycle causes -
- App Pool Recycle/server reset/reboot
- Touching or modifying web.config
- Touching anything in an application folder (bin folder or any of the 7 ASP.NET special folders - App_Code etc)
- Adding/deleting folders
- IIS settings that affect app pool
- IIS settings that affect web.config (change to Default Document in IIS causes app recycle as this file is referenced in web.config)
- Root machine.config & web.config changes (but modifying applicationHost.config will have no impact)
- Some failures at AppPool or AppDomain level