0

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

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

4

1 回答 1

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>
于 2016-07-01T13:33:53.003 回答