Remote server services Starting using C#

Karthikanbarasan
Posted by Karthikanbarasan under C# category on | Points: 40 | Views : 3863
using System.Diagnostics;
using System.Threading;

Service controller should be used along with the thread in order to refresh or start the process with a bit time in order to avoid overlapping

System.ServiceProcess.ServiceController svcobj = new System.ServiceProcess.ServiceController(ServiceName, ServerIP);
if (svc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Running))
{
svcobj .Start();
Thread.Sleep(10000);
}

Comments or Responses

Login to post response