Search code examples
iisappdomainvirtual-directory

Application domain restarts when physical path changes


I am trying to minimize downtime when updating web application on IIS6 - I have two folders (one with current application and one with new code). Once I switch virtual directory's physical path to new folder, recompilation occurs ("Application is shutting down. Reason: The physical path of the application changed."). However, if I switch physical paths couple more times between old and new, sometimes recompilation does not occur. E.g.:

  • Switched to folderB
  • Event code: 1002 Event message: Application is shutting down. Reason: The physical path of the application changed.
  • Switched back to folderA
  • Event code: 1001 Event message: Application is starting. (no shutdown?)
  • Switched back to folderB
  • Event code: 1001 Event message: Application is starting. (no shutdown?)

What is the reason that domain is not always restarted?


Solution

  • ASP.NET uses per application hash code which is different for each application (computed from application name, physical path and probably other parameters). Switching back and forth between physical paths results in two different codes (and two folders in "Temporary ASP.NET files"). Once applications were JIT'ed no shutdown occurs.