473,320 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Q: Timer in windows service not trapping exceptions...

I have a windows service that creates and starts a timer. And when the
timer has elapsed, it performs a few things and resets the timer.
(AutoReset = false, so it only executes once).

However, in the handling thread - I am assuming that the elapsed handler is
running on a separate thread from the main one - if an exception occurs, it
seems to be lost. The exception is not propagated up the chain where the
service with AutoLog set to true, should catch it and log it to windows
event log. The exception simply disappears as I confirmed while debugging
in the IDE.

Anyone know why this may be happening?
Also, if using a timer is not the right solution to invoke a set of commands
at certain intervals, what alternatives are there?

Thanks in advance
Jiho
Aug 1 '05 #1
1 1464
BTW, I am using System.Timers.Timer.
I think I am going to try using System.Threading.Timer instead...

"Jiho Han" <ji******@infinityinfo.com> wrote in message
news:eO****************@TK2MSFTNGP12.phx.gbl...
I have a windows service that creates and starts a timer. And when the
timer has elapsed, it performs a few things and resets the timer.
(AutoReset = false, so it only executes once).

However, in the handling thread - I am assuming that the elapsed handler
is running on a separate thread from the main one - if an exception
occurs, it seems to be lost. The exception is not propagated up the chain
where the service with AutoLog set to true, should catch it and log it to
windows event log. The exception simply disappears as I confirmed while
debugging in the IDE.

Anyone know why this may be happening?
Also, if using a timer is not the right solution to invoke a set of
commands at certain intervals, what alternatives are there?

Thanks in advance
Jiho

Aug 1 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: andrewcw | last post by:
I am trying to do a windows service with C#. I am using as a base the VB.NET article in VS, but I thing the WITHEVENTS timer notation is a delegate. Can anyone provide sample code & anh hints. ...
2
by: Beeeeeeeeeeeeves | last post by:
Hi I have created a windowds service project, it is working fine and I can debug it ok, but there is one thing up - when I drop a timer onto it, it doesn't work. I have set the service to be a...
5
by: Dhilip Kumar | last post by:
Hi all, I have developed a windows service using the windows service project template in VS.NET. I have used three controls in the service, a timer, performance counter and a message queue...
2
by: John David Thornton | last post by:
I've got a Windows Service class, and I put a System.Threading.Timer, and I've coded it as shown below. However, when I install the service and then start it in MMC, I get a peculiar message: ...
1
by: Jiho Han | last post by:
I have a windows service that creates and starts a timer. And when the timer has elapsed, it performs a few things and resets the timer. (AutoReset = false, so it only executes once). However,...
11
by: Kevin Antel | last post by:
We have written a service that uses a timer control to check for a process every 60 seconds. This is installed on a Windows 2003 Server w/SP1. The problem we are running into is that the service...
10
by: Ryan | last post by:
Hello everyone, I have made a service that starts timers when it starts. I have another windows form application that stops and starts the service. Do I need to deal with any started timers when...
1
by: jan.loucka | last post by:
I'm developing WinForms application in .NET 2.0 that talks to web service. The automatically generated proxy (reference class) has got methods for both synchronous and asynchronous invocations of...
8
by: Ollie Riches | last post by:
I'm looking into a production issue related to a windows service and System.Timers.Timer. The background is the windows service uses a System.Timers.Timer to periodically poll a directory location...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.