I am having an issue with an application that I am creating. I am trying to start a windows service through my C# app. When I click my start button, it looks like everythi
First of all you need to add reference of the DLL (ServiceProcess) in your project References as like:
Right click on References in Solution Explorer -> Add Reference -> Assemblies ->
Framework -> System.ServiceProcess
Then add ServiceProcess DLL in your project:
using System.ServiceProcess;
After that use this code:
ServiceController service = new ServiceController(yourServiceName);