Exemplo n.º 1
0
 /// <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);
     }
 }
Exemplo n.º 2
0
        /// <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);
            }
        }