Re: Windows Service stopped working



Did any of the responses posted in response to your original post on this
subject 5 days ago help?


"Trevor" <tsides @ intelligentsystemsconsulting.com> wrote in message
news:%23k9NuYlNGHA.3732@xxxxxxxxxxxxxxxxxxxxxxx
Argh! This problem is driving me nuts! Can you help?

In November of 2003, I installed a web service on Windows Server 2003
built in VB.NET for v1.1.4322 of the framework. It contains a timer
(System.Timers.Timer) which has an interval of 24 hours. Actually, it
reads a time like 2AM out of the config file, and calculates the time
between the start of the service to 2AM, and sets the timer. When the
timer expires, it re-reads the configuration file (in case it has changed)
and re-sets the timer (which usually ends up being 24 hours).

When the timer expires, it compares the current system time against a
global variable (Private LastExecuted As Date). LastExecuted is set as
the current time when a File Watcher (System.IO.FileSystemWatcher) is
tickled. So, when the timer expires at 2AM, it makes a database update,
then checks to see that LastExecuted is not more than an hour ago,
otherwise it sends an e-mail (the file we expected to receive today didn't
arrive).

After running continuously since November 2003, the timer suddenly started
setting itself to sub-second intervals in May, 2005. When people came to
work in the morning to 5,000+ e-mail messages, I got the call. I rebooted
the service, and all was fine until Dec. 2005, when it happened again.
Now, in Feb. 2006, it has happened again, and the only way to stop the
sub-second time intervals was to reboot the whole server. Interstingly,
even though the timer expired several times per second and sending an
e-mail every time, it wasn't re-reading the configuration file (the next
subroutine call after sending the e-mails) and recognizing changes to the
values therein. A week later, though, the timer now has some unknown
interval (because it's not expiring at all, or, the elapsed logic -
database update, e-mails and configuration file read - are not happening).

This server used to be rebooted on a daily basis, but that stopped
sometime in 2004 or 2005. I don't know if that's a clue to the problem.
I use the Event Log a lot. Should I be releasing the memory reserved by
the MyLog variable? Otherwise, I have no idea what might be wrong with
the code. Please help!

In case this helps - the code which sets the interval of the timer:

Private Function ProperTimerInterval() As Double
Dim MyLog As New EventLog
MyLog.Source = "MyCompany"

Dim NextCheckTime As Date
If CInt(Time.Text.Substring(0, 2)) < CInt(Date.Now.Hour) Then
NextCheckTime = Date.Parse(Date.Now.AddDays(1).Date & " " &
Time.Text)
Else
NextCheckTime = Date.Parse(Date.Now.Date & " " & Time.Text)
End If
NextCheckTime = NextCheckTime.AddHours(1)

Dim IntervalToReturn As Double =
NextCheckTime.Subtract(Date.Now).TotalMilliseconds

If Debug.Text.ToLower = "true" Then
MyLog.WriteEntry("The daily timer is set to expire in " &
IntervalToReturn & " milliseconds, which is " & IntervalToReturn / 1000 /
60 / 60 & " hours.", EventLogEntryType.Information)
End If

Return IntervalToReturn
End Function



.



Relevant Pages

  • Re: VBSript to read multiple CSV files & write out to 1 CSV file
    ... Also the various Dim statements may fail because VBScript only supports variant type variables. ... the batch file and target file every time it runs. ... Dim myHead As Single 'Timer at start ... >> Is the delimiter a constant marker or only used in the text fields? ...
    (microsoft.public.access.externaldata)
  • RE: Help with VBA............Again.
    ... Dim newColor As Integer ... Do Until Timer> Delay ... A with individual cells in column B, then compare individual cells in column ...
    (microsoft.public.excel.programming)
  • Re: CUSTOM DIALOG BOXES
    ... Dim startTime As Single ... While Timer < startTime + duration ... DoCmd.Close acForm, myName, acSaveNo ...
    (microsoft.public.access.forms)
  • Re: How can I time the speed of a macro?
    ... tend to just use the Timer function since the elapsed time for all the loops ... Dim nTime As Double ... Dim StartTime As Double ... Dim EndTime As Double ...
    (microsoft.public.excel.programming)
  • Re: How can I time the speed of a macro?
    ... tend to just use the Timer function since the elapsed time for all the ... Dim nTime As Double ... Dim StartTime As Double ... Dim EndTime As Double ...
    (microsoft.public.excel.programming)