N
nivedita
I got below function from http://techinterviewquestion.blogspot.com/
blog. it is working fine. i used
public void StartService(string ServiceName)
{
ServiceController sc = new ServiceController(ServiceName);
if (sc != null && sc.Status == ServiceControllerStatus.Stopped)
{
sc.Start();
sc.WaitForStatus(ServiceControllerStatus.Running);
}
}
blog. it is working fine. i used
public void StartService(string ServiceName)
{
ServiceController sc = new ServiceController(ServiceName);
if (sc != null && sc.Status == ServiceControllerStatus.Stopped)
{
sc.Start();
sc.WaitForStatus(ServiceControllerStatus.Running);
}
}