none
Timers in service works in XP but not 2008 RRS feed

  • Question

  • I have been reading threads all day and I really hate to add another to the timer topic, but I am stuck.

     

    I have a windows service in which I have used both System.Threading.Timer and System.Timers.Timer.  Both work fine on my development system.  (XP)  However when I try to install this onto a 2008 server neither work.

     

    The Timers.Timer version continues to run but never fires the event.

    The Threading.Timer, just crashes when called.  I am currently using the Threading version.  I put the code below.

    The timer_elapsed declaration is included as well.

     

    It doesn't get much simplier right now.  I was wondering if it is account permissions or something else that I am missing on the 2008 server which stops this from running.

    period = (30 * 60 * 1000);
           
    AutoResetEvent autoEvent = new AutoResetEvent(false);
    TimerCallback timerDelegate = new TimerCallback(timer_Elapsed);
    
    timer = new System.Threading.Timer (timerDelegate, autoEvent,
            0, period);<pre lang="x-c#">void timer_Elapsed (Object stateInfo)
    

    Thursday, November 18, 2010 6:17 PM

Answers