473,388 Members | 1,340 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,388 software developers and data experts.

Windows services shutdown order

I'm written a Windows Service to send e-mails on events
like OnStart, OnStop, OnShutDown using System.Web.Mail.
It works for everything but OnShutdown. My guess is that
once my send mail code is executed, other necessary
Windows Services have been terminated before it can
actually send the mail. I've updated my
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es
registry DependOnService value including SMPTSVC and
others. My hope is that the services will shut-down in
reverse order from start-up; I haven't had any luck with
this.

My Questions:
Do Windows Services (Windows 2000) shutdown in the reverse
order from which they start-up?

If so, any idea's as to which service I should include as
a dependency?

If not, is there anyway I can ensure my Windows Service is
the first to shutdown?

Thanks,

~Bill
Jul 21 '05 #1
4 7094
Bill,

Chris Brumme has a bit to say on OS shutdown - you might find it usefull.

http://blogs.gotdotnet.com/cbrumme/P...f-097efb25d1a9

Jerry Dennany

"Bill Sonia" <bi*******@achaiasolutions.com> wrote in message
news:08****************************@phx.gbl...
I'm written a Windows Service to send e-mails on events
like OnStart, OnStop, OnShutDown using System.Web.Mail.
It works for everything but OnShutdown. My guess is that
once my send mail code is executed, other necessary
Windows Services have been terminated before it can
actually send the mail. I've updated my
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es
registry DependOnService value including SMPTSVC and
others. My hope is that the services will shut-down in
reverse order from start-up; I haven't had any luck with
this.

My Questions:
Do Windows Services (Windows 2000) shutdown in the reverse
order from which they start-up?

If so, any idea's as to which service I should include as
a dependency?

If not, is there anyway I can ensure my Windows Service is
the first to shutdown?

Thanks,

~Bill

Jul 21 '05 #2
Good article but it's a little lower level then my
original question. I have a windows service that will
send e-mail discribing the status of my server. I'm
trying to send an e-mail on shutdown but thus far have
been unsuccessful. Is there a way I can trigger this
before all of the appropriate services are shutdown? Do
the services shutdown in reverse order from which they
started?

Thanks
-----Original Message-----
Bill,

Chris Brumme has a bit to say on OS shutdown - you might find it usefull.
http://blogs.gotdotnet.com/cbrumme/P....aspx/dac5ba4a -f0c8-42bb-a5cf-097efb25d1a9
Jerry Dennany

"Bill Sonia" <bi*******@achaiasolutions.com> wrote in messagenews:08****************************@phx.gbl...
I'm written a Windows Service to send e-mails on events
like OnStart, OnStop, OnShutDown using System.Web.Mail.
It works for everything but OnShutdown. My guess is that once my send mail code is executed, other necessary
Windows Services have been terminated before it can
actually send the mail. I've updated my
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es
registry DependOnService value including SMPTSVC and
others. My hope is that the services will shut-down in
reverse order from start-up; I haven't had any luck with
this.

My Questions:
Do Windows Services (Windows 2000) shutdown in the reverse order from which they start-up?

If so, any idea's as to which service I should include as a dependency?

If not, is there anyway I can ensure my Windows Service is the first to shutdown?

Thanks,

~Bill

.

Jul 21 '05 #3
Hi Bill,

If these services have dependency relationship, they should be shutdown in
reverse order of start; if not, they can be shutdown seperately. I suggest
you take a look at this article:

Debugging Windows Service Applications
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbtskdebuggingserviceapplications.asp

You may debug into the lines in shutdown event to see if you find any
further information.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 21 '05 #4
Ray
If I understand your question correctly, your service fails to send email
because the email service is no longer active, or SMTP service actually, if
thats the case maybe you want to put the SMTP service in your list of
Services that your service depends on so you can send mail until the point
your service shutsdown.

Ray
"Bill Sonia" <bi*******@achaiasolutions.com> wrote in message
news:00****************************@phx.gbl...
Good article but it's a little lower level then my
original question. I have a windows service that will
send e-mail discribing the status of my server. I'm
trying to send an e-mail on shutdown but thus far have
been unsuccessful. Is there a way I can trigger this
before all of the appropriate services are shutdown? Do
the services shutdown in reverse order from which they
started?

Thanks
-----Original Message-----
Bill,

Chris Brumme has a bit to say on OS shutdown - you might

find it usefull.

http://blogs.gotdotnet.com/cbrumme/P....aspx/dac5ba4a

-f0c8-42bb-a5cf-097efb25d1a9

Jerry Dennany

"Bill Sonia" <bi*******@achaiasolutions.com> wrote in

message
news:08****************************@phx.gbl...
I'm written a Windows Service to send e-mails on events
like OnStart, OnStop, OnShutDown using System.Web.Mail.
It works for everything but OnShutdown. My guess is that once my send mail code is executed, other necessary
Windows Services have been terminated before it can
actually send the mail. I've updated my
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es
registry DependOnService value including SMPTSVC and
others. My hope is that the services will shut-down in
reverse order from start-up; I haven't had any luck with
this.

My Questions:
Do Windows Services (Windows 2000) shutdown in the reverse order from which they start-up?

If so, any idea's as to which service I should include as a dependency?

If not, is there anyway I can ensure my Windows Service is the first to shutdown?

Thanks,

~Bill

.

Jul 21 '05 #5

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

Similar topics

2
by: Austin | last post by:
I wrote a program running on windows. I put the link of the program in "Start up" folder and let it executed minimized. Every time when I open the computer, my program will be running in system...
8
by: Bill Sonia | last post by:
I've written a Windows Service to send e-mails on events like OnStart, OnStop, OnShutDown using System.Web.Mail. It works for everything but OnShutdown. My guess is that for OnShutDown, once my...
6
by: carbon_dragon | last post by:
Ok, so here is the problem. I'm working on a headless server program implemented as a .NET C# Console project. There is a UPS mounted to this server (though not a windows compliant UPS). I can only...
4
by: Bill Sonia | last post by:
I'm written a Windows Service to send e-mails on events like OnStart, OnStop, OnShutDown using System.Web.Mail. It works for everything but OnShutdown. My guess is that once my send mail code is...
2
by: Peter Meinl | last post by:
Restarting Windows seems not to fire the OnShutdown event in the Windows Service. Does not work on Windows XP SP2 and not on Windows 2003 Server SP1. OnStart and OnStop do work fine. Steps...
0
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...
4
by: Markus Stoeger | last post by:
Hi, I have a problem with Application.Run() when Windows is shutting down. Please have a look at the copy&paste example program below. The application has no forms. It has only got a notify...
0
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: List of autostart locations Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list all the autostart locations for windows? Ans: Here is...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.