Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
705 views
in Technique[技术] by (71.8m points)

installation - How to install and start a Windows Service using WiX

I tried to use the codes below in Wix.

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

Thanks a lot!

    <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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...