如何使用 WiX 安装和启动 Windows 服务 [英] How to install and start a Windows Service using WiX
本文介绍了如何使用 WiX 安装和启动 Windows 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在 Wix 中使用以下代码.
I tried to use the codes below in Wix.
但是在安装时,安装程序在状态下冻结了大约 3 分钟:正在启动服务,然后我收到此消息服务 Jobservice 无法启动.验证您是否有足够的权限来启动系统服务".我的代码有问题吗?以及是否可以要求用户在安装过程中输入windows系统用户名和密码来获取权限"?
But when installing, the installer was freezing for like 3 minutes on status: Starting services, then I got this message "Service Jobservice failed to start. Verify that you have sufficient privileges to start system services". Is there any wrong in my codes? And can I ask the user to input the windows system user name and password during the installation to get the "privileges"?
非常感谢!
<File Id='JobServiceEXE' Name='JobService.exe' DiskId='1'
Source='JobService.exe' Vital='yes' KeyPath='yes'/>
<ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes"
Name="JobService" DisplayName="123 Co. JobService"
Description="Monitoring and management Jobs" Start="auto"
Account="LocalSystem" ErrorControl="ignore" Interactive="no" />
<ServiceControl Id="StartService" Stop="both" Remove="uninstall"
Name="JobService" Wait="yes" />
</Component>
推荐答案
以下代码对我有用...无需提示输入用户名/密码 :)
The following code works for me... no need to prompt for username/password :)
<File Id='JobServiceEXE' Name='JobService.exe' DiskId='1' Source='JobService.exe' KeyPath='yes'/>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="JobService"
DisplayName="123 Co. JobService"
Description="Monitoring and management Jobs"
Start="auto"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
ErrorControl="normal"
/>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="JobService" Wait="yes" />
</Component>
这篇关于如何使用 WiX 安装和启动 Windows 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文