public void Start() { using (var service = new WindowsService("MSMQ")) { service.Start(); } }
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(); } }
void Restart() { using (var service = new WindowsService("MSDTC")) { service.Restart(); } }