Sometime you need to start/stop windows services from your C# MVC application. Here i am sharing how you can do that: 1) To access windows service you need to add below namespace in your controller:
If you are getting error as "namespace name 'ServiceController' could not be found" while adding above namesapce you need to add using "Add Reference". For more details see my blog HERE 2) Add below code to your controller:
ServiceController service = new ServiceController("Test Windows Service"); service.Start();
It will start your services.