How to stop a windows service in Visual Studio 2003
-
Hello. In Visual Studio 2005, there is a Stop method that you can call from any method to stop the service. That is useful in case something went wrong. I see that in Visual Studio 2003, that method doesn't exist. How can I then stop the service from code?
Regards, Diego F.
-
Hello. In Visual Studio 2005, there is a Stop method that you can call from any method to stop the service. That is useful in case something went wrong. I see that in Visual Studio 2003, that method doesn't exist. How can I then stop the service from code?
Regards, Diego F.
Hi Diego, Although I'm not 100% sure of how to do it, hopefully this puts you in the right direction. A service can only be started or stoped by the OS (for what I understand anyways...). So to stop it you either have to use the Services management snap-in in Win2k / XP etc or the NET command from the command prompt. Stopping it from your code is probably going to be easier from the latter... NET Stop Hope this helps! Having said all the above... have a look see here... http://support.microsoft.com/kb/245230[^]
TimmyFox