如何以零停机时间部署 ASP.NET 应用程序 [英] How to deploy an ASP.NET Application with zero downtime

查看:23
本文介绍了如何以零停机时间部署 ASP.NET 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要部署我们网站的新版本,我们执行以下操作:

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

  1. 压缩新代码,并将其上传到服务器.
  2. 在实时服务器上,从 IIS 网站目录中删除所有实时代码.
  3. 将新代码 zipfile 解压到现在为空的 IIS 目录中

这个过程全部是脚本化的,并且发生得非常快,但是在删除旧文件和部署新文件时仍然可能有 10-20 秒的停机时间.

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.

对 0 秒停机方法有什么建议吗?

Any suggestions on a 0 second downtime method?

推荐答案

您需要 2 个服务器和一个负载平衡器.步骤如下:

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

  1. 开启服务器 2 上的所有流量
  2. 在服务器 1 上部署
  3. 测试服务器 1
  4. 开启服务器 1 上的所有流量
  5. 在服务器 2 上部署
  6. 测试服务器 2
  7. 打开两台服务器上的流量

事实是,即使在这种情况下,如果您使用粘性会话",您仍然会遇到应用程序重新启动和会话丢失的情况.如果您有数据库会话或状态服务器,那么一切都应该没问题.

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.

这篇关于如何以零停机时间部署 ASP.NET 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆