0
votes

I have this mosquitto.exe which I need to install as a Windows Service using WiX. When I create a Windows Service project and run the EXE through its start method everything works fine. But is it possible to run the mosquitto.exe using only the ServiceControl and ServiceInstall lines and without having a separate Windows Service project? I tried this but the Service fails to start though it isntalls fine.

 </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>

Have I done something wrong here or do I really need to launch this mosquitto.exe through an another exe created using a Windows Service project? Any help would be much appreciated.

1
When dealing with Windows services, the Windows event log is the place to look. Both the standard logs, which would tell you a service failed to start and any custom log, which might tell you why. Often services are designed to do some checks on start up and if they fail, their logic says to fail to start.Tom Blodget

1 Answers

1
votes

Never heard of Mosquitto before but a quick look at its project site and its installer (NSIS) says that it is a Windows service. That installer just runs mosquitto.exe install and mosquitto.exe uninstall as appropriate.

In general, I'd recommend letting third-party installers do what they do—until proven unreliable. To use their installer, you could create a WiX Bootstrapper project (uses the "burn" package manager; project typically has a bundle.wxs with a Bundle root element).

There could be command-line arguments (standard NSIS or custom) that you want to pass to it, such a silent install.