Click here to Skip to main content
15,885,890 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Windows Service - How to setup auto-start & auto-stop? It looks to be it can't setup through Window Service Properties Wizard. Is there a way to setup auto-start & auto-stop (e.g. programmatically using a piece of C# code)? Thanks in advance.
Posted

1 solution

In your project installer, set the property of your ServiceInstaller.
 
Share this answer
 
v2
Comments
s yu 21-Aug-14 15:49pm    
PhiLenoir: Thanks for your solution. I opened my WinService Install.bat Properties, but couldn't find which one can be used for the auto-stop and -start. Could you describe more detail? Thanks again.
PhilLenoir 21-Aug-14 15:52pm    
Have you added an installer class (project => add new item => General +> Installer class)?
Once you have an installer class, you view in the design pane, click on the Service Installer and your properties pane shows a startup option.
s yu 22-Aug-14 11:56am    
I did not use your approach. I have install.bat. I will credit you solution and may update my project per your recommendation. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900