Visual Studio 2010 发布/Web 部署问题
我正在使用 Publish/Web Deploy 从 Visual studio 2010 部署 asp.net 应用程序。它运行完美,但有一个问题。如果新版本未按预期工作,则旧版本已被新版本取代,并且没有简单的方法可以回滚到工作版本。这个问题如何最好解决?我希望可以在服务器上保留旧版本,这样我就可以在需要时切换回来。
I'm using Publish/Web Deploy to deploy an asp.net aplication from Visual studio 2010. It works perfect, but there is a problem. If the new release is not working as expected, the old version is already replaced by the new one and there is no easy way to roll back to the working version. How is this best solved? I wish it was possible to keep the old version on the server so I could just switch back if needed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WebDeploy 没有内置的回滚功能,因此一旦部署即可。
您可以采取多种手动策略,例如:
有限访问,例如共享托管:
如果您没有对计算机的完全访问权限 -
事先备份实时站点下载它。
保留您部署的内容的副本,以便在出现问题时可以推送以前的版本
完全访问:
为应用程序维护两组文件夹,并将您的站点映射到其中一个或另一个文件夹。当您进行部署时,将 IIS 站点的物理路径切换到 other 文件夹,然后进行部署。如果站点失败,则只需将站点恢复到原始文件夹即可。每次成功的部署都会在这两个文件夹之间交替。
对于用户上传的内容之类的内容,您需要将虚拟目录映射到文件系统上始终相同的位置,因为您不希望每次都复制这些内容。
您不是唯一遇到这些问题的人。请阅读 Rob Conery 撰写的这篇文章以及他对 ASP.NET 部署现状的观察。
With WebDeploy there is no built in rollback feature, so once you've deployed that's it.
There's a number of hand rolled strategies you could put in place, for example:
Limited Access e.g. Shared Hosting:
Where you don't have full access to the machine -
Backup the live site beforehand by downloading it.
Keep copies of what you deployed so you can push the previous version should something break
Full Access:
Maintain two sets of folders for the application and map your site to one or other of these folders. When you come to deploy switch the IIS site's physical path to the other folder then deploy. If the site fails then just knock the site back to the original folder. Each successful deploy would alternate between these two folders.
For stuff like user uploaded content you'd need to map virtual directories to a place on the file system that's always the same place because you don't want to be copying these around each time.
You're not the only one who has encountered these issues. Have a look at this article by Rob Conery and his observations about the state of affairs regarding ASP.NET deployment.
使用某种形式的源代码管理将是另一种选择。我们使用 subversion,所以如果发布失败,我们可以更新回最后一个好的版本,然后发布。即使您是唯一的开发人员,使用源代码管理也非常有用。
Using some form of Source Control would be another alternative. We use subversion, so if the publish goes bad, we can just update back to the last-good revision, and publish that. Even if you're the only developer, using source control can be very useful.