Andrew
Andrew

Reputation:

Release new version of ASP.NET website - Best Practices

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.

Upvotes: 5

Views: 673

Answers (6)

robmzd
robmzd

Reputation: 1823

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.

Upvotes: 1

Ferry Meidianto
Ferry Meidianto

Reputation: 120

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.

Upvotes: 0

user152949
user152949

Reputation:

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.

Upvotes: 0

cjk
cjk

Reputation: 46475

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.

Upvotes: 0

Zhaph - Ben Duguid
Zhaph - Ben Duguid

Reputation: 26976

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.

Upvotes: 5

T. Stone
T. Stone

Reputation: 19495

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.

Upvotes: 0

Related Questions