471,337 Members | 1,158 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

system shutdown check from windows service

hi,
i have a windows service that check to the external web site
httpwebresponse and save the result into log text file. and, my problem is
when i shut down my system, i also would like to save the time that i shut
down my system into that log file. but, i don't know how to do that. so,
please give me some idea or suggestion on that.

thanks,
myo zaw
Nov 30 '05 #1
3 4322
Myo Zaw wrote:
hi,
i have a windows service that check to the external web site
httpwebresponse and save the result into log text file. and, my problem is
when i shut down my system, i also would like to save the time that i shut
down my system into that log file. but, i don't know how to do that. so,
please give me some idea or suggestion on that.

thanks,
myo zaw


The simliest thing would be to use the onshutdown event in the service
to write out your log file. This won't tell you if the system is
shutting down or not so you'll get both the service stopping because of
system shutdown or user stopping the service.

Chris
Nov 30 '05 #2

"Myo Zaw" <in********@hotmail.com> wrote in message
news:u%****************@TK2MSFTNGP11.phx.gbl...
hi,
i have a windows service that check to the external web site
httpwebresponse and save the result into log text file. and, my problem is
when i shut down my system, i also would like to save the time that i shut
down my system into that log file. but, i don't know how to do that. so,
please give me some idea or suggestion on that.

thanks,
myo zaw

Override the OnShutDown event handler...
Check MSDN for ServiceBase.OnShutDown for more info.
Willy.
Nov 30 '05 #3
thanks,
it went fine. but, one more question, i don't know why i can't access
to app.config file in my windows service. it worked fine in win32
application. i already tested with the same situation but, in my service,
the call from configurationmanager showed me that null value was return. any
idea about that?

thanks again,
myo zaw
Dec 1 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Andy | last post: by
6 posts views Thread by eroc.spam | last post: by
6 posts views Thread by Ash | last post: by
2 posts views Thread by Sin Jeong-hun | last post: by
10 posts views Thread by tshad | last post: by
reply views Thread by rosydwin | last post: by

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.