0

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?

Vanita
  • 663
  • 1
  • 7
  • 25
  • Hi Christopher Painter,,I want to reach you,can you please help me out for the below http://stackoverflow.com/questions/38352117/msi-user-interface-wizard-session-with-wix – SrilakshmiCh Jul 14 '16 at 12:59

1 Answers1

0

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>
Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • This seems to install the service but the installer hangs on 'starting service' and eventually gives an error about requiring the correct permissions? Is this because the node server code isn't a valid windows service? – Vanita Jul 01 '16 at 14:00
  • It should work provided you don't have other issues with your (service) script. the 1920 incorrect permissions message is always a misnomer. You have to run your program and see if it throws an error or hangs starting. – Christopher Painter Jul 01 '16 at 14:35