24

我们有一个使用 NServiceBus 发布事件的网站。该站点是使用 msdeploy 部署的。我们还有 NServiceBus.exe,它应该作为 Windows 服务运行以订阅这些事件,我们也想部署它。

有没有办法将服务和网站打包,以便也可以安装?是否可以单独打包,以便我们可以将其部署到另一台服务器?

任何关于在哪里可以找到有关如何执行此操作的信息的提示都会很棒,因为我们现在可以为网站进行自动部署。

4

3 回答 3

5

我最近使用 MSDeploy、Phantom 和 installUtil.exe 完成了这项工作

您基本上只需要修改您的安装程序类并在需要时提升您的远程 wmsvc 服务权限。

链接到博客

于 2011-03-13T05:19:05.887 回答
4

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".

于 2010-11-16T13:33:39.573 回答
4

这是我用来同步从Windows Service.proj文件中的构建后步骤创建的存档目录的 msdeploy cmd 行。

它正在从我的构建服务器同步到我在不同网络上的应用服务器。我有启动和停止远程服务器上的服务的构建前和构建后步骤。由于 powershell 和 msdeploy 的错误,您必须将 powershell 脚本包装在 vb 脚本中。该-verbose选项非常有用。

我也有下面的 vbscript 和 ps1 脚本。小心 VB 睡眠以及前后 msdeploy 超时。

msdeploy -verb:sync -source:archivedir=\\qa-xxxxx1.qa.lan\deployment\backups\FreddieMacDelivery\FreddieMacDelivery.zip,tempAgent='True',computerName=qa-xxxxx1.qa.lan,userName=QA\xxxxx,password=xxxx,authtype=NTLM,includeAcls='False' -dest:dirpath=\\qa-xxxxxx1.qa.lan\protk\Services\FreddieMacDelivery\1.4.1.test -useCheckSum -verbose -preSync:runCommand="cscript.exe c:\temp\stop_win_svc.vbs" -postSync:runCommand="c:\temp\start_win_svc.vbs",waitInterval=15000,waitAttempts=1

VB脚本:

Option Explicit
Dim oShell, appCmd,oShellExec
Set oShell = CreateObject("WScript.Shell")

appCmd = "powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ""&c:/temp/Get_Win_SVC.ps1"" "

Set oShellExec = oShell.Exec(appCmd)

WScript.Sleep 1000
oShellExec.StdIn.Close()

Powershell脚本:

$username = 'QA\xxxxx'
$password = 'xxxxx'
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))

(Get-WmiObject  -computer qa-xxxx1.qa.lan  -Credential $cred Win32_Service -Filter "Name='ProTeck.FreddieMac.DeliveryService'")


$svc = (Get-WmiObject  -computer qa-xxxxx1.qa.lan  -Credential $cred Win32_Service -Filter "Name='ProTeck.FreddieMac.DeliveryService'") 

Write-Host  $svc

$svc.InvokeMethod("StartService", $null)


(Get-WmiObject  -computer qa-xxxxx1.qa.lan  -Credential $cred Win32_Service -Filter "Name='ProTeck.FreddieMac.DeliveryService'")> c:\temp\win_stat_post.txt
于 2011-09-09T14:11:50.493 回答