473,545 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Window Service on Shutdown

I created a window service...

When i stop the service through MMC, it can see in the EventLog that it
calls OnStop() within the service... and all stop handling routines are
processed gracefully...

but when i do, Start, ShutDown to restart the computer, the EventLog
does not show anything...

Can i trust that the OnStop was called anyway? If not, how to make sure
windows calls my OnStop before shutting down?

Thanks.

Oct 19 '05 #1
2 1405
On 18 Oct 2005 22:52:16 -0700, tascien wrote:
I created a window service...

When i stop the service through MMC, it can see in the EventLog that it
calls OnStop() within the service... and all stop handling routines are
processed gracefully...

but when i do, Start, ShutDown to restart the computer, the EventLog
does not show anything...

Can i trust that the OnStop was called anyway? If not, how to make sure
windows calls my OnStop before shutting down?


Override the OnShutdown method. That's what should be called when Windows
is shut down.
Oct 19 '05 #2
Still nothing in the eventLog.

I am just assuming the EventLog is closed when the computer is shutting
down... Isn't it?

Tascien

Oct 19 '05 #3

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

Similar topics

23
7557
by: Adam Clauss | last post by:
I have a C# Windows Service running as the NetworkService account because it needs to access a network share. As part of the service's initialization, I want the service to terminate, if an unrecoverable error occurs. When that case occurs, I create a ServiceController object and call the Stop() method. However - I get an exception...
2
1781
by: Mr Newbie | last post by:
I have an annoying teenager who wont go to bed because he is allways on his computer. I want to write a windows service which will shut down his computer at night and not allow this to be restarted until the morning. So I have decided to try and write a windows service to do this. Stage one is to see if I can get the damn thing to shutdown...
2
219
by: tascien | last post by:
I created a window service... When i stop the service through MMC, it can see in the EventLog that it calls OnStop() within the service... and all stop handling routines are processed gracefully... but when i do, Start, ShutDown to restart the computer, the EventLog does not show anything... Can i trust that the OnStop was called...
0
2131
by: Stefan Krah | last post by:
Hello, I'm trying to run a Python script as a Windows service with a defined shutdown. The script (enigma-client.py) handles the communications with the server in a distributed computing effort and calls a C program (enigma.exe) to do the computations. enigma.exe should save its current state when receiving SIGINT or SIGTERM. This...
0
1160
by: Mathew Clark | last post by:
I'm trying to write a Windows Service that is capable of detecting when a shutdown is occurring, and cancelling it. I've managed to get this to work fine in a windows application, using SystemEvents.SessionEnding, like so: - Private Sub MyBase_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ...
6
7014
by: eroc.spam | last post by:
Hello- I'm working with a .NET windows service that can potentially take up to 10 minutes to shutdown. I would like to make it so that SCM doesn't timeout before the service actually stops, but unfortunately have not found a method that works. I've tried using ServiceBase.RequestAdditionalTime in several ways: 1) Start the shutdown...
6
9489
by: Ash | last post by:
Hi coders, I have a service that does alot of data copying to the database and when the service is stopped or the machine is shutting down it commits the data (in addition to other things) and makes sure it exists gracefully (this could take upto 5-6 mins). I tried increasing...
1
5544
by: chitra g | last post by:
Hi, I tried all the options below but did not work. Your suggestions please.
10
3227
by: tshad | last post by:
I have a Windows Service that I need to put to sleep for about 10-20 minutes. The problem is that if you try to shut it down during this time, it will tell you that the service didn't respond in time and end up in a "Stopping" state and there is nothing you can do until you reboot the system. What I did to solve the problem was just set a...
0
7484
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7675
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7440
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4963
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3470
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1902
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
726
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.