goodmorningsky Posted March 23, 2005 Posted March 23, 2005 Hi, all I want to stop starting windows service if any error found during start. How can I do? public class DLSWinService : System.ServiceProcess.ServiceBase{ ... protected override void OnStart(string[] args) { ServiceController sc = GetServiceController("DLSWinService");//this method returns right controller. sc.Stop(); // this doesn't work..!! } } Is there a way to cancel starting and leaving service stopped.? Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
HJB417 Posted March 23, 2005 Posted March 23, 2005 throwing an exception should prevent the service from starting. Quote
goodmorningsky Posted March 24, 2005 Author Posted March 24, 2005 Thank you. I got it. Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
goodmorningsky Posted March 24, 2005 Author Posted March 24, 2005 I throwed exception.. Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.