I've written a small windows service that I want to run daily on my Windows Server 2008. The service is written in C#.
net start Service1
The Service1 service is starting........ The Service1 service could not be started.
The service did not report an error.
More help is available by typing NET HELP:SG 3534.
The service could not be controlled in its present state.
More help is available by typing NET HELPMSG 2189
The OnStart event is used to launch a background thread that will take care of the processing. If the OnStart method finishes without error, the service manager assumes the service started successfully. As such, the OnStart should return as soon as possible.
The OnStop method is then used to stop the background processing. A successful OnStop tells the service manager that the service was closed without error.