我们有一个使用 NServiceBus 发布事件的网站。该站点是使用 msdeploy 部署的。我们还有 NServiceBus.exe,它应该作为 Windows 服务运行来订阅这些事件,我们也想部署它。
有什么办法可以将服务和网站打包在一起,以便也可以安装吗?是否可以单独打包以便我们可以将其部署到另一台服务器上?
关于在哪里可以找到有关如何执行此操作的信息的任何提示都很棒,因为我们现在可以为网站进行自动化部署。
We have a website which publishes events using NServiceBus. The site is deployed using msdeploy. We also have the NServiceBus.exe which should run as a windows service to subscribe to these events, and we'd like to deploy that as well.
Is there any way to package the service as well as the website, so that it can be installed as well? Is it possible to package separately so we can deploy it to another server?
Any tips on where to find information on how to do this would be great, as we can do automated deployments for the website now.
发布评论
评论(3)
我最近使用 MSDeploy、Phantom 和 installUtil.exe 完成了此操作。
您基本上只需要修改安装程序类并在需要时提升远程 wmsvc 服务权限。
博客链接
I recently did this using MSDeploy, Phantom and installUtil.exe
You just basically need to modify your installer class and elevate your remote wmsvc service privileges if needed.
Link to blog
我们最终要做的是创建一个“控制器”层来协调部署任务,甚至可以使用 msdeploy。本质上,msdeploy 并不是我们部署系统中的最高抽象级别。
我们选择使用 MSBuild 来协调从“包”部署项目的任务。
在我们的部署过程中,使用msdeploy部署的Web应用程序只是另一个部署项,就像Windows服务一样。
总而言之,我们实际上还没有创建 msdeploy 部署任务,尽管它应该/会很好地融入到我们已经创建的任务中,因为 MSBuild 会调用 msdeploy。目前,我们使用 MSBuild 社区任务来实现 Web 应用程序部署自动化,并通过 MSBuild 进行协调。
您可以通过我写的一篇名为“PANDA - 打包和部署自动化”。
What we wound up doing was creating a 'controller' layer that coordinates deployment tasks, even one that could use msdeploy. Essentially, msdeploy is not the highest level of abstraction in our deployment system.
We chose to use MSBuild to coordinate those tasks of deploying items from a 'package'.
In our deployment process, a web application deployed with msdeploy is just another deployment item, just as is a Windows service.
In all disclosure, we have not actually created msdeploy deployment tasks yet, though it should/would drop in nicely to what we've already created, as MSBuild would invoke the msdeploy. We currently use MSBuild community tasks for webapp deployment automation, coordinated via MSBuild.
You can read a little more about how we 'generalized' our deployments via a blog post I did called "PANDA - Packaging ANd Deployment Automation".
下面是我用来同步从
Windows Service.proj
文件中的构建后步骤创建的 archivedir 的 msdeploy 命令行。它正在从我的构建服务器同步到不同网络上的应用程序服务器。我有启动和停止远程服务器上的服务的构建前和构建后步骤。由于 powershell 和 msdeploy 存在错误,您必须将 powershell 脚本包装在 vb 脚本中。
-verbose
选项非常有用。我还有下面的 vbscript 和 ps1 脚本。请注意 VB 睡眠以及 msdeploy 前后的超时。
VB 脚本:
Powershell 脚本:
Here is a msdeploy cmd line I used to sync an archivedir that is created from a post-build step in my
Windows Service.proj
file.It is syncing from my build server to my app server on a different network. I have pre and post build steps that start and stop the services on the remote server. You must wrap the powershell script in a vb script due to a bug with powershell and msdeploy. The
-verbose
option is very helpful.I also have the vbscript and ps1 script below. Be careful with the VB sleep and the pre and post msdeploy timeouts.
VB script:
Powershell script: