471,356 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

Stopping the service from within System.ServiceProcess.ServiceBase

What if a service needs to signal the ServiceControlManager (SCM) that it is
stopping for instance, a necessary parameter or object is missing or failed
and is discovered in the OnStart method of System.ServiceProcess.ServiceBase.

In C++ when using the CServiceBase class I could look for a WM_QUIT message
in Run() and call SetServiceStatus(SERVICE_STOP_PENDING, ...
In C# I don't see a method that would signal the SCM (SERVICE_STOP_PENDING,
or any other message id) or a method to pass a message via the SCM back to my
service.

I guess you could say I am looking for an easy way to have the SCM fire the
OnStop event by way of receiving a message from the OnStart event handler. I
would appreciate any help I can get on this. Thanks...
Jul 21 '05 #1
0 1078

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Scupper | last post: by
4 posts views Thread by c_shah | last post: by
1 post views Thread by =?Utf-8?B?cm9zczYxMw==?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.