views:

250

answers:

6

What is the best practice for releasing a new version of my asp.net application?

I am concerned about users currently using the application. If I push a new version, does it kick them out? How does IIS handle open sessions?

I am looking for a simple way of pushing new releases without affecting users.

A: 

In Stack Overflow Podcast #63 Jeff Atwood makes a reference to how Stack Overflow handles this. He says something to the effect of they know exactly when the low peak times are, and the site basically goes offline for a few seconds, then comes back up.

T. Stone
But they also have load balanced servers now ( http://blog.stackoverflow.com/2009/09/load-balancing-stack-overflow/ ), and so can take one offline, deploy changes, bring it back on line, and take the other one down - which should result in the site appearing to stay up.
Zhaph - Ben Duguid
ah, but Podcast #63 was recorded in late July when everything was one "one big server" (that cost $1200).
T. Stone
+5  A: 

I'm assuming you don't have a load-balanced environment, with multiple web servers?

In which case the best thing you could do is probably:

  1. Look at your logs, and work out when you have the least traffic.

  2. Assuming you have a site-wide master page, modify the .master to have a message warning people that site maintenance will be taking place during a certain period. If you're not using a master page, add the message on your home page, and other high traffic pages.

  3. Drop an app_offline.html file into the root of your site at the designated time.

  4. Deploy your changes.

  5. Remove the app_offline.html file from the root.

  6. Request your homepage, and hope it worked.

Zhaph - Ben Duguid
And write a script to do all this!
Konstantin Spirin
A: 

If you are using the web application model, dropping in a new DLL will cause the applciation to restart, so that any running operations will be interrupted, and session data and caches will expire. Cookies will remain intact, so users will stay logged in.

ck
A: 

Warn or Notify your users about the updates (just put simple text at the header of the website when you will do the updates). On doing updates, make sure you put the app to offline, you can do it by simply put app_offline.htm file at the root folder. Then do your updates and remove the app_offline.htm to put your web back to online.

Ferry Meidianto
A: 

Two alternatives presented:

  1. There is a ninja trick that not many know about, and that is to have two production environments, when the new environment is up-and-running change your DNS servers to point to the new environment, this way people will not loose their state and will use the new site when their DNS cache is renewed, usually within one day. After a day it should be safe to take the second (old) production environment offline, when it is time to upgrade again one can switch to that envrionment again asf.

  2. To make the downtime as low as possible I would create a new virtual directory on the production server with a sub-site like test.example.com, when it works there I would change the www.example.com virtual directory file path to point to the new directory and then remove test.example.com. If you are using some kind of state that does not rely on cookies or is RESTful some users will loose their state as the application pool is restarted. Always announce before you do this so that users are prepared, and as others have pointed out it is best to do this when there is as low a traffic as possible.

Inge Henriksen
A: 

I tend to follow something along the lines of:

  1. Create a new directory for the updated application (wwwroot/myAppV1/, wwwroot/myAppV2/, etc...)
  2. Setup a new virtual directory under the main application to point to the new app (use a guid for the virtual directory if you're security conscious)
  3. Test the application through the virtual directory
  4. Add the app_offline.htm file to the current working application
  5. Re-point the website directory in IIS to the new directory when you're happy it works

Apart from potential IIS setting updates this tends to work best for me. It gives a chance to test the application before switching back to live.

Rob Marsden