Example #1
0
 public void Start()
 {
     using (var service = new WindowsService("MSMQ"))
     {
         service.Start();
     }
 }
Example #2
0
        public void VerifyRunning(bool allowStart)
        {
            using (var service = new WindowsService("MSDTC"))
            {
                bool running = service.IsRunning();
                if (running)
                    return;

                if (!allowStart)
                    throw new InvalidOperationException("The MSDTC is not running and allowStart was not specified.");

                service.Start();
            }
        }
Example #3
0
 void Restart()
 {
     using (var service = new WindowsService("MSDTC"))
     {
         service.Restart();
     }
 }