Click here to Skip to main content
15,891,431 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to call DLL function in generic method? Pin
vicky4571-Feb-08 6:58
vicky4571-Feb-08 6:58 
QuestionHow to assign DataView to Datatable Pin
ss.mmm31-Jan-08 9:27
ss.mmm31-Jan-08 9:27 
AnswerRe: How to assign DataView to Datatable Pin
J$31-Jan-08 9:38
J$31-Jan-08 9:38 
GeneralComboBox TextChanged Event firing unexpectedly [modified] Pin
DaveyM6931-Jan-08 8:29
professionalDaveyM6931-Jan-08 8:29 
GeneralThreading help Pin
daphne7531-Jan-08 8:21
daphne7531-Jan-08 8:21 
GeneralRe: Threading help Pin
Luc Pattyn31-Jan-08 11:03
sitebuilderLuc Pattyn31-Jan-08 11:03 
GeneralRe: Threading help Pin
daphne751-Feb-08 9:19
daphne751-Feb-08 9:19 
GeneralLogging Shutdown event in Windows Service Pin
abupsman31-Jan-08 7:46
abupsman31-Jan-08 7:46 
I would like to request some suggestions on a problem I am having with a Windows Service I built.

It installs and runs fine, using a timer every minute to check for files, then running a process.

I have the process logging to a Windows Event Log, also, every time if does find and process a file it writes a record to a remote SQL server with file stats.

The third thing the service does is send out e-mails.
One type is a daily summary with totals and stats
The second is whenever an error is caught, it collects the error data and sends it to a support group (Also writes to the event log)

I also e-mail, write SQL & log at service Start and Stop.

The issue is that the logging works OK at Stop if I do it from the Services panel in Admin Tools. However, if the Box is re-started by doing a Start/Shutdown/Re-start, I get no logging or e-mails to notify that the box is going down. I do get the Start up messages and logging minutes later when the system restarts.

However, if someone were to do a Start/Shutdown/Shutdown, I would not be notified and it might be several hours before other processes noticed that the data stream had stopped and complain about it.

Here is the code from my OnStop section:

protected override void OnStop()<br />
        {<br />
            //Close all open connections<br />
            closeResources("ALL",9);<br />
<br />
            // Log shutdown event<br />
            eventLogOSNUCAS.WriteEntry("OSNUCAS Reader is shutting down",EventLogEntryType.Error);<br />
<br />
            //writeDashboardLogLine on SQL<br />
            writeDashboardLogLine("OMAH799", "###########", 0, "OSNUCAS Reader is shutting down", 0, 0, 0, 0, "Stopped", "##########NUCASReader on " + Environment.MachineName + " has shut down");<br />
<br />
            // Notify support<br />
            AutoEMailSender("########## NUCAS Reader is shutting down", "########### NUCAS Reader service is shutting down\n", 1);<br />
<br />
<br />
        }


What do I have to do to ensure that a shutdown event is logged?

(Obviously, I cannot log a power outage, but a UPS generated forced shutdown due to low battery would also NOT be recorded)

Thanks, Don
GeneralRe: Logging Shutdown event in Windows Service Pin
CKnig31-Jan-08 18:56
CKnig31-Jan-08 18:56 
QuestionHow to instantiate an object with a generic parameter? Pin
michal.kreslik31-Jan-08 7:31
michal.kreslik31-Jan-08 7:31 
AnswerRe: How to instantiate an object with a generic parameter? Pin
Giorgi Dalakishvili31-Jan-08 8:18
mentorGiorgi Dalakishvili31-Jan-08 8:18 
AnswerRe: How to instantiate an object with a generic parameter? Pin
Ennis Ray Lynch, Jr.31-Jan-08 9:00
Ennis Ray Lynch, Jr.31-Jan-08 9:00 
AnswerRe: How to instantiate an object with a generic parameter? Pin
Le centriste31-Jan-08 10:05
Le centriste31-Jan-08 10:05 
GeneralRe: How to instantiate an object with a generic parameter? Pin
michal.kreslik31-Jan-08 10:26
michal.kreslik31-Jan-08 10:26 
GeneralRe: How to instantiate an object with a generic parameter? Pin
Le centriste31-Jan-08 12:59
Le centriste31-Jan-08 12:59 
GeneralRe: How to instantiate an object with a generic parameter? Pin
michal.kreslik31-Jan-08 13:17
michal.kreslik31-Jan-08 13:17 
AnswerRe: How to instantiate an object with a generic parameter? Pin
darkelv31-Jan-08 14:18
darkelv31-Jan-08 14:18 
GeneralRe: How to instantiate an object with a generic parameter? Pin
michal.kreslik6-Feb-08 4:05
michal.kreslik6-Feb-08 4:05 
AnswerRe: How to instantiate an object with a generic parameter? Pin
Mark Churchill1-Feb-08 2:47
Mark Churchill1-Feb-08 2:47 
GeneralRe: How to instantiate an object with a generic parameter? Pin
michal.kreslik6-Feb-08 22:12
michal.kreslik6-Feb-08 22:12 
GeneralRe: How to instantiate an object with a generic parameter? [modified] Pin
Mark Churchill7-Feb-08 0:07
Mark Churchill7-Feb-08 0:07 
GeneralRefresh Pin
kibromg31-Jan-08 7:14
kibromg31-Jan-08 7:14 
GeneralRe: Refresh Pin
pmarfleet31-Jan-08 8:43
pmarfleet31-Jan-08 8:43 
Generalmarshaling an array of structs Pin
damianrda31-Jan-08 6:23
damianrda31-Jan-08 6:23 
GeneralDeleting Outlook Appointments Pin
NewToAspDotNet31-Jan-08 6:15
NewToAspDotNet31-Jan-08 6:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.