0
votes

Does anyone know how to use WiX (Windows Installer XML) to install a node server and start it as a windows service?

At the moment the application doesn't have a .exe file, just a bat file which runs 'node app.js' which starts the server. I was wondering if it's possible to install this as a service using wix, or does it have to be converted into an .exe file first?

1
Hi Christopher Painter,,I want to reach you,can you please help me out for the below stackoverflow.com/questions/38352117/…SrilakshmiCh

1 Answers

0
votes

You can use srvany.exe to take any kind of script / executable and host it as a service. The WiX then looks something like:

<Component Id="c1" Guid="someguid">
  <File Id="f1" Source="$(var.SourceDir)\srvany.exe" KeyPath="yes" />
  <ServiceInstall Id="si1" DisplayName="servicedisplay" Description="servicedesc" Name="servicename" Start="auto" Type="ownProcess" Vital="no" ErrorControl="normal" Account="NT AUTHORITY\NetworkService"  />
  <ServiceControl Id="sc1S" Name="servicename" Remove="both" Stop="both" Start="install" Wait="yes" />
  <RegistryValue Id="reg1" Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\ExpertChatPeerServer\Parameters" Name="Application" Type="string" Value="node &quot;[#f2]&quot;" Action="write" />
</Component>
<Component Id="c2" Guid="someguid" KeyPath="yes">
  <File Id="f2" Source="$(var.SourceDir)\somenodescript.js" />
</Component>