public static void RestartSB()
{
string ServiceName = "SolutionBuilder Core Service";
ServiceController service = new ServiceController();
service.MachineName = ".";
service.ServiceName = ServiceName;
string status = service.Status.ToString();
try
{
if (service.Status == ServiceControllerStatus.Running)
{
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped);
}
//Recycle App Pool
try
{
RecycleAppPool();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
if (service.Status == ServiceControllerStatus.Stopped)
{
service.Start();
service.WaitForStatus(ServiceControllerStatus.Running);
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}