/// <summary> /// Starts the service on target machine. /// </summary> protected virtual void Start(TimeSpan timeout, string service) { try { using (Common.Util.ServiceControl sc = new Common.Util.ServiceControl(_serverName, service)) { if (!sc.IsRunning) { sc.WaitForStart(timeout); } } } catch (Exception e) { throw new ManagementException(e.Message, e); } }
/// <summary> /// Starts the service on target machine. /// </summary> protected virtual void Start(TimeSpan timeout, string service) { try { #if NETCORE if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux)) { throw new Exception("Failed to start service. Please try the operation manually."); } #endif using (Common.Util.ServiceControl sc = new Common.Util.ServiceControl(_serverName, service)) { if (!sc.IsRunning) { sc.WaitForStart(timeout); } } } catch (Exception e) { throw new ManagementException(e.Message, e); } }