By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

system shutdown check from windows service

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a

"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

P: n/a
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.