有谁知道如何使用 WiX (Windows Installer XML) 安装节点服务器并将其作为 Windows 服务启动?
目前,该应用程序没有 .exe 文件,只有一个运行“node app.js”的 bat 文件来启动服务器。我想知道是否可以使用 wix 将其安装为服务,还是必须先将其转换为 .exe 文件?
有谁知道如何使用 WiX (Windows Installer XML) 安装节点服务器并将其作为 Windows 服务启动?
目前,该应用程序没有 .exe 文件,只有一个运行“node app.js”的 bat 文件来启动服务器。我想知道是否可以使用 wix 将其安装为服务,还是必须先将其转换为 .exe 文件?
您可以使用 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 "[#f2]"" Action="write" />
</Component>
<Component Id="c2" Guid="someguid" KeyPath="yes">
<File Id="f2" Source="$(var.SourceDir)\somenodescript.js" />
</Component>