Server-based timers working.

  • Thread starter Thread starter archana
  • Start date Start date
A

archana

Hi all,

can anyone tell me how server based timer in .net works?

Which one of either system.timers.timer, system.threading.timer is
better for use in windows service.

How worker thread call elapsed event. Will it depend on any of system
factors?

If anyone can shed some light on it then it will really benefical for
me.

thanks in advance.
 
System.Timers.Timer t = new System.Timers.Timer();
t.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
t.Interval = 2000;
t.Enabled = true;

try out this
 
Hi,

Thanks for your reply.

I am doing same thing. It is working properly for say 7-8 days and
suddently timer_slaped is not getting raised.

can you tell me reason behind this.

thanks in advance.
 
Sorry to say but Well buzy right now ..........

if u dun mind can me one ans

Hello friends can any body tell me how to redact image in web
application. thanks, Sachin.
 
Hi,

The two most notable differences is that the System.Timers.Timer class is a
Component-based timer that can be dropped into the component tray of a
designer, and it's inherently thread-safe. There are other differences as
well, but I tend to use the System.Threading.Timer in all circumstances where
designer support isn't required, event though thread-safety must be explicitly
enforced.

"Comparing the Timer Classes in the .NET Framework Class Library"
http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx
 
What version of .NET are you using? We had a situation where an application
has a number of timers, and under .NET 1.1 they would periodically just stop
firing. After we upgraded to .NET 2.0 the problem resolved itself. I'm
assuming this was some bug in the timers implementation.
 
HI,

This could be due another problems, do u have a logging in place?
capture AppDomain.UnHandledException and log any possible exceptions
 
Hi,
Hi,

Thanks for your reply.

I am doing same thing. It is working properly for say 7-8 days and
suddently timer_slaped is not getting raised.

can you tell me reason behind this.

thanks in advance.

In .NET 1.1, there is a known bug with System.Timers.Timer. The symptom
is, yes, that they just stop working after a few days. We replaced them
with System.Threading.Timer and it works fine.

I don't know if the bug is corrected in 2.0.

HTH
Laurent
 
Hi,

thanks a lot for lots of replies.

I am using .net framework 1.1 . And in that i am facing this problem.

I can't switch to framework 2.0 right now. so is there any alternative
avaialble in 1.1 framework to fix this problem.

any help will be truely appreciated.

thanks in advance.
 
Give what Laurent suggested a try - use System.Threading.Timer a try instead
of System.Timers.Timer. Other than that, it's just a bug in the framework
and there probably isn't much you can do until you can update to 2.0.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top