472,789 Members | 1,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 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 1113

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tom J | last post by:
What do I have to do to get System.ServiceProcess.ServiceController.ExecuteCommand(int) to work? I have written a service that overrides OnCustomCommand to handle commands sent to it. If I...
0
by: Scupper | last post by:
I'm trying to write an application that will periodically check a server for certain services and, if they are not running, attempt to start them. I'm using System.ServiceProcess and have no...
1
by: SQLScott | last post by:
I am using the System.ServiceProcess methods to look at the status of several services. It will tell me if it is Stopped, Started, etc. But how do I tell if a service is Not Responding, or Hung?...
2
by: SQLScott | last post by:
In the OnStart sub of my service (as the service is starting up) I check for certain things. If one of a few things don't jive, I want to "cancel" the starting of the service. How do I...
0
by: RayG | last post by:
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...
1
by: SenthilVel | last post by:
Hi We use System.ServiceProcess.ServiceController class is used to get the list of windows services installed in a particular machine. Also we use...
4
by: c_shah | last post by:
I have a web application developed in ASP.net 2.0. I have to use SQL server authentication (Our outside hosting company only allows sql authentication) Inside that web application I have a web...
1
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I'm puzzled by an error message encountered while creating a Windows Service. In particular, I'm creating a second Windows Service within a Windows Service project, using Visual Studio 2005. The...
8
by: Ollie Riches | last post by:
I'm looking into a production issue related to a windows service and System.Timers.Timer. The background is the windows service uses a System.Timers.Timer to periodically poll a directory location...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.