StartService(string XXXServiceName) { serviceController = new System.ServiceProcess.ServiceController(XXXServiceName); log.Info(XXXServiceName + " service status is currently set to " + serviceController.Status.ToString()); if ((serviceController.Status.Equals( System.ServiceProcess.ServiceControllerStatus.Stopped)) || (serviceController.Status.Equals( System.ServiceProcess.ServiceControllerStatus.StopPending))) { serviceController.Start(); serviceController.Refresh(); log.Info(ConfiguratorManagerServiceName + " service status is currently set to " + serviceController.Status.ToString()); } } StopService(string XXXServiceName) { serviceController.Stop(); serviceController. log.Info(XXXServiceName + " service status is currently set to " + serviceController.Status.ToString()); }
February 13, 2006
Use ServiceController class to stop and start services.
Use ServiceController class to stop and start services. This is useful within NUnit tests.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment