I have a Windows service that I am installing using InstallUtil.exe. Although I have set the startup method to Automatic, does not start after installing the service, I have to manually open the services and start getting started. Is it a way to start through a command line or through the service code?
In your installer class, add a handler for later events. You can call the service controller in the service controller to start the service.
Using the system. service of process; Public ServiceInstaller () {// ... installer code here. After this, install + new = InstallEventHandler (ServiceInstaller_AfterInstall); } Zero ServiceInstaller_Affiliate installs (Object Sender, InstallEventArgs e) {(ServiceController sc = New Service Controller (serviceInstaller.ServiceName)) {sc.Start (); }}
Now when you run InstallUtil on your installer it will be installed and then start the service.
Comments
Post a Comment