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>
We can start the Windows Service automatically after installation by making use of the AfterInstall event handler which triggers immediately after Windows Service is installed. You will need to open the ProjectInstaller class and override the AfterInstall event handler and add the code to start the Windows Service.
Create Setup Project for Window Service Open a dialog box, go to left pane under Installed Templates > Other Project Types > Setup and Deployment > Visual Studio Installer and go to the right pane and select the project as a “Setup Project” and click on the OK button.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With