asp.netiisdeploymentredundancy

How to deploy an ASP.NET Application with zero downtime


To deploy a new version of our website we do the following:

  1. Zip up the new code, and upload it to the server.
  2. On the live server, delete all the live code from the IIS website directory.
  3. Extract the new code zipfile into the now empty IIS directory

This process is all scripted, and happens quite quickly, but there can still be a 10-20 second downtime when the old files are being deleted, and the new files being deployed.

Any suggestions on a 0 second downtime method?


Solution

  • You need 2 servers and a load balancer. Here's in steps:

    1. Turn all traffic on Server 2
    2. Deploy on Server 1
    3. Test Server 1
    4. Turn all traffic on Server 1
    5. Deploy on Server 2
    6. Test Server 2
    7. Turn traffic on both servers

    Thing is, even in this case you will still have application restarts and loss of sessions if you are using "sticky sessions". If you have database sessions or a state server, then everything should be fine.