private static void serviceStart()
{
ServiceController[] scServices;
scServices = ServiceController.GetServices();
foreach (ServiceController scTemp in scServices)
{
if (scTemp.ServiceName == "open-audit-check-service")
{
ServiceController sc = new ServiceController("open-audit-check-service");
if (sc.Status == ServiceControllerStatus.Stopped)
{
int tries = 0;
sc.Start();
while (sc.Status == ServiceControllerStatus.Stopped && tries < 5)
{
Thread.Sleep(1000);
sc.Refresh();
tries++;
}
}
}
}
}