0

我有这个 mosquitto.exe,我需要使用 WiX 将其安装为 Windows 服务。当我创建一个 Windows 服务项目并通过其启动方法运行 EXE 时,一切正常。但是是否可以仅使用 ServiceControl 和 ServiceInstall 行并且没有单独的 Windows 服务项目来运行 mosquitto.exe?我试过这个,但服务无法启动,虽然它不是很好。

 </Component>
  <Component Id="cmp59455E1C37B7879C4BC250DE3D60A2AD" Directory="MyProgramDir" Guid="179B4F4C-912B-4CA1-8F08-5E1B4ADFFD8B" Win64="no">
    <File Id="fil7D28AEF774656849395A2FA20A5C963D" KeyPath="yes" Source="../../../Setups/mosquitto/mosquitto/mosquitto.exe" />
   <ServiceInstall Id="MosquittoSI" Type="ownProcess" Name="Mosquitto" DisplayName="Mosquitto" Description="Mosquitto broker service" Start="auto" Account="LocalSystem"  ErrorControl="normal"/>
 <ServiceControl Id="MosquittoSC" Start="install" Stop="both" Remove="uninstall" Name="Mosquitto" Wait="no" />  
</Component>

我在这里做错了什么还是我真的需要通过使用 Windows 服务项目创建的另一个 exe 来启动这个 mosquitto.exe?任何帮助将非常感激。

4

1 回答 1

1

以前从未听说过 Mosquitto,但快速浏览一下它的项目站点,它的安装程序(NSIS) 说它是一个 Windows 服务。该安装程序会根据需要mosquitto.exe install运行mosquitto.exe uninstall

一般来说,我建议让第三方安装程序做他们所做的事情——直到被证明不可靠。要使用他们的安装程序,您可以创建一个 WiX Bootstrapper 项目(使用“烧录”包管理器;项目通常有一个带有 Bundle 根元素的 bundle.wxs)。

可能有您想要传递给它的命令行参数(标准 NSIS 或自定义),例如静默安装。

于 2016-07-24T01:09:56.273 回答