【发布时间】:2013-08-19 04:07:38
【问题描述】:
我正在使用 WiX 为我们基于 NServiceBus 的解决方案创建安装程序,但在安装后无法启动主机服务。
如果我从命令行使用NServiceBus.Host.exe /install 运行主机的安装程序,它可以正常安装,甚至在我启动服务时启动成功。
但是,当我在 WiX 中使用 ServiceInstall 元素创建服务时,它无法启动服务。我尝试使用ServiceControl 元素在我的安装程序中启动该服务,并从 WIndows 服务控制面板进行安装后。
我试图在 WiX 中使用的代码是:
<Component Id="NServiceBus.Host" Guid="PUT-GUID-HERE" Win64="yes">
<File Id="NServiceBus.Host" KeyPath="yes"
Source="$(var.[Project].TargetDir)NServiceBus.Host.exe" Checksum="yes" />
<ServiceInstall Id="NServiceBus.Host.Install"
Name="[Product].Host" DisplayName="[Product]" Type="ownProcess"
Account="NT Authority\Network Service" Interactive="no" Start="auto"
Vital="yes" ErrorControl="normal">
<ServiceDependency Id="MSMQ" />
<ServiceDependency Id="MSDTC" />
</ServiceInstall>
<ServiceControl Id="NServiceBus.Host.Control" Name="[Product].Host"
Start="install" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
我在其他项目中使用相同的代码来安装和运行服务,所以我很确定问题与 NServiceBus 的主机有关。此处的服务也似乎安装正确,但无法运行。
有没有人能够使用 WiX 将NServiceBus.Host.exe 安装为服务?或者有谁知道当我运行 NServiceBus.Host.exe /install 时是否还有其他步骤发生在我的 WiX 安装程序中?
我知道我可以在运行 NServiceBus.Host.exe /install 的 WiX 中创建一个 CustomAction,但如果可能的话,我宁愿避免这样做,并以正确的 (WiX) 方式安装服务。它还避免了我需要考虑卸载操作和排序。
编辑:作为参考,这是我使用 WiX 的 MsmqExtension 创建队列的方式:
<Component Id="NServiceBus.Host.Queue" Guid="PUT-GUID-HERE" Win64="yes">
<msmq:MessageQueue Id="Queue1" Label="[Product] Host"
PathName=".\private$\[Product].Host"
Transactional="yes" PrivLevel="optional" />
<msmq:MessageQueue Id="Queue2" Label="[Product] Host Retries"
PathName=".\private$\[Product].Host.Retries"
Transactional="yes" PrivLevel="optional" />
<msmq:MessageQueue Id="Queue3" Label="[Product] Host Timeouts"
PathName=".\private$\[Product].Host.Timeouts"
Transactional="yes" PrivLevel="optional" />
<msmq:MessageQueue Id="Queue4" Label="[Product] Host Timeouts Dispatcher"
PathName=".\private$\[Product].Host.TimeoutsDispatcher"
Transactional="yes" PrivLevel="optional" />
</Component>
【问题讨论】:
-
您能提供 NSB 日志和 app.config 吗?
标签: wix nservicebus