472,374 Members | 1,457 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,374 software developers and data experts.

Solution for the Error : The service did not respond to the Stop call in a timely fashion

Hi,
I am writing a service which takes a long time to stop after the OnStop
call is given by the Services Snap-in. The problem is I cannot cut down on
the time that it takes to Stop. The Service snap-in gives me the error
saying that the service did not respond to the Stop call in a timely
fashion. So is there any method by which I can get around this problem.

Thanks
Prasad


Sep 28 '05 #1
2 2695
Sure. You can run the job in a separate thread than the main execution
thread. Calling Stop will send a message to the child thread instructing it
to stop itself, and the main execution thread can continue processing. This
is what is called an "asynchronous" operation, as opposed to a "blocking"
operation.

For example, I have a service that runs a certain kind of job. The service
doesn't actually do the job; an instance of a class that exists in the
service runs the job. The OnStart method of the Service calls the class's
"Start" method, which spawns a chilc thread executing the "Run" method of
the class. The OnStop method of the service calls the class's "Stop" method,
which sets a property in the class, which the child thread looks at from
time to time. The "Stop" method then continues on its way. The child thread
looks at the property, sees that it needs to stop, and stops itself.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.

"Prasad" <ek*********@yahoo.co.uk> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hi,
I am writing a service which takes a long time to stop after the OnStop
call is given by the Services Snap-in. The problem is I cannot cut down on
the time that it takes to Stop. The Service snap-in gives me the error
saying that the service did not respond to the Stop call in a timely
fashion. So is there any method by which I can get around this problem.

Thanks
Prasad

Sep 28 '05 #2
Thnx man.
But I had done the same thing what u suggested but the problem is the
Service Snap - in shows that the service has stopped but there is still the
background thread running which means that the process is still running. I
dont want this to happen. I want to negotiate with the SCM on the time and
it should show that the Service stopped if the process is really completed.

Thanks
Prasad

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
Sure. You can run the job in a separate thread than the main execution
thread. Calling Stop will send a message to the child thread instructing
it to stop itself, and the main execution thread can continue processing.
This is what is called an "asynchronous" operation, as opposed to a
"blocking" operation.

For example, I have a service that runs a certain kind of job. The service
doesn't actually do the job; an instance of a class that exists in the
service runs the job. The OnStart method of the Service calls the class's
"Start" method, which spawns a chilc thread executing the "Run" method of
the class. The OnStop method of the service calls the class's "Stop"
method, which sets a property in the class, which the child thread looks
at from time to time. The "Stop" method then continues on its way. The
child thread looks at the property, sees that it needs to stop, and stops
itself.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Big things are made up of
lots of little things.

"Prasad" <ek*********@yahoo.co.uk> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Hi,
I am writing a service which takes a long time to stop after the
OnStop
call is given by the Services Snap-in. The problem is I cannot cut down
on
the time that it takes to Stop. The Service snap-in gives me the error
saying that the service did not respond to the Stop call in a timely
fashion. So is there any method by which I can get around this problem.

Thanks
Prasad


Sep 29 '05 #3

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

Similar topics

0
by: Water Cooler v2 | last post by:
It was all good when a few days ago, I started getting this error on my Windows 2000 Professional SP4 box when trying to start IIS 5.5. "The service did not respond to the start or control...
2
by: Prasad | last post by:
Hi, I am writing a service which takes a long time to stop after the OnStop call is given by the Services Snap-in. The problem is I cannot cut down on the time that it takes to Stop. The Service...
1
by: magnus.s.olsson | last post by:
I have got a Windows Service application from a customer that I try to start. The customer can start it with no problem, but when I try to start it I get: "Could not start the GateWay service on...
4
by: whoamir | last post by:
HI GUYS, I am ramesh from mumbai. i am new in this group. i am facing a problem in IIS.its stopped its not running.. when i tryed to restart it its showing The service did not respond to the...
2
by: =?Utf-8?B?Sm9obiBTLg==?= | last post by:
I developed a Windows Service application written in vb.net and have successfully installed it on many workstations (over 25 PCs). All workstations have Windows XP SP2 installed. There are two...
3
by: kneidels | last post by:
Hey folks on XPP here. I have always had IIs started by default, but suddenly now i see my default (and only) website is off. i get this message when trying to start it - running...
6
by: alho | last post by:
The web service is called by a program running on pocket pc. When to call the web service, the first call is still ok, but for the second or later calls, it will throw "403 Forbidden" WebException....
0
by: Kristi | last post by:
This is the Command: CPYTOIMPF FROMFILE(LSPMPRDTA/LS600F) + TOSTMF('\KWIKTAG\KWIKTAG.TXT') + MBROPT(*REPLACE) STMFCODPAG(*PCASCII) +
2
by: NitinSawant | last post by:
Dear sir, I've installed SQL Server 2008 on my machine running on Win XP SP3 I changed startup type of sql server from 'Automatic' to 'manual' from the "SQL Server Configuration Manager", when...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.