How to deploy an ASP.NET Application with zero downtime

后端 未结 11 1355
日久生厌
日久生厌 2020-11-28 00:38

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
11条回答
  •  失恋的感觉
    2020-11-28 01:21

    I would refine George's answer a bit, as follows, for a single server:

    1. Use a Web Deployment Project to pre-compile the site into a single DLL
    2. Zip up the new site, and upload it to the server
    3. Unzip it to a new folder located in a folder with the right permissions for the site, so the unzipped files inherit the permissions correctly (perhaps e:\web, with subfolders v20090901, v20090916, etc)
    4. Use IIS Manager to change the name of folder containing the site
    5. Keep the old folder around for a while, so you can fallback to it in the event of problems

    Step 4 will cause the IIS worker process to recycle.

    This is only zero downtime if you're not using InProc sessions; use SQL mode instead if you can (even better, avoid session state entirely).

    Of course, it's a little more involved when there are multiple servers and/or database changes....

提交回复
热议问题