473,394 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 2817
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.