Peter

Peter

  • NA
  • 5
  • 2.7k

Windows Service sends mailing multiple times after restart

Nov 23 2011 10:05 AM
Hi all,

I have a problem with a service that sends mailings to customers. Basically, what the mailing does is check a database table for scheduled mailings to send. When it finds one, it gets the addresses from another db table and loops through them to send an email to every address. 
 
This works fine except in the following two situations.
1. After a restart of the service, if there are mailings scheduled, the first mailing to be sent is sent twice. Later mailings are ok.
2. After a reboot of the server and a restart of the service it is the same except that the first mailing gets sent multiple times, up to 19 times!! Later mailings are again ok.

It doesn't seem to be a problem in the code (c#) because it only happens the first time after a restart (or is that short-sighted?). It only happens after a restart when there is already a mailing waiting to be sent. When the service is started with no mailings waiting and I then add a new mailing, everything works fine.

Any ideas? Any help would be greatly appreciated.

Peter

Answers (5)