使用WiX将节点服务器安装为Windows服务

时间:2016-07-01 12:19:57

标签: node.js wix windows-installer wix3.10

有谁知道如何使用WiX(Windows Installer XML)安装节点服务器并将其作为Windows服务启动?

目前应用程序没有.exe文件,只是一个运行'node app.js'的bat文件启动服务器。我想知道是否可以使用wix将其安装为服务,还是必须首先将其转换为.exe文件?

1 个答案:

答案 0 :(得分:0)

您可以使用srvany.exe获取任何类型的脚本/可执行文件并将其作为服务托管。然后,WiX看起来像:

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