System.timers.timer in windows service??

K

Kevin Yu

hi all
I have a question for the timer in the windows service.
it seems that the code(e.g. sending an email message) within the timer
elapsed event handler won't run.
I have an eventlog writter within the handler too, the log is written
into the eventlog, but no email message is sent and there is not error
message given.

what's going on? do I have to create another process to call an external
exe?

Kevin
 
D

drew

I typically stay away form the timers.timer and go with threading.timer in
services since mine tend to run a very long time.

If you're seeing log activity then the timer is probably fine but you want
to make sure that if you're using email (not sure which you're using) that
that object is setup properly. There are 5 or 6 different DLLs that support
the email in .NET (office cdo, cdonts, smtp... on and on) and they report
invalid email sends very poorly. Also since you'll typically be interoping
between .NET and these COM objects, you won't be able to drill through in
the debug window.
 
K

Kevin Yu

Drew

I move the code into the same function in the timer elapsed handler instead
of putting it in a separated class. now everything works fine. but the email
relay from the smtp server in our corporate network seems to be a bit slow,
I use SMTP component. It is an COM interop object. but it works.

thx for the response.

Kevin
 

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

Top