views:

222

answers:

2

We deploy our websites as a single MSI package. We deploy to IIS 6.0 (Windows 2003) and they run on .NET 3.5. The problem I have is that when we upgrade to a new version of our websites, users may be half way with a long-running task. What I need is the following:

  1. How to stop users from starting new requests
  2. Let users with long-running tasks finish their task
  3. Redirect users to a landing page while the website is being upgraded.

I was hoping for IIS to provide some support for these scenarios but I think I may out of luck. Is the only to achieve this by adding custom functionality to the website?

+6  A: 

The best way to do an ASP.NET deployment which will prevent user interaction is by putting up an app_offline.htm file, see Scott Gu's post here - http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

App_offline is really nice as it prevents any traffic to anywhere on your site. It's what they use on SO when they do upgrades.

Slace
The problem is that it instantly stops the web application. What I need is not to accept any new connections and let current sessions finish.
Richard Nienaber
+1  A: 

Also consider moving to a session state server through a ms sql session provider. This removes the loss of session state due to any web application recycling (bin dll updates, web.config changes)

You may run into some other problems if you're changing your session structures with this approach.

I've also read about the use of load balanced hardware to accomplish this. Something like

  1. Redirect all existing sessions to server A
  2. Update server B
  3. Redirect all new sessions to server A.
  4. When server A has no more sessions upgrade it.
itchi