如何使用WiX安装和启动Windows服务 [英] How to install and start a Windows Service using WiX

查看:174
本文介绍了如何使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆