lock (mutex) between services on multiple machines

  • Thread starter Thread starter Oleg.Ogurok
  • Start date Start date
O

Oleg.Ogurok

Hi there,

I have a .NET Windows Service which utilizes System.Threading.Timer and
performs a task every 15 minutes. The task is performed on a shared
database (e.g. querying, creation of records, etc.)
I would like to install the service on 2 or more servers for redundancy
reasons.
However, I need only one server to perform the task at a time.
E.g. if the service on Server1 is already processing, other servers
should wait.

How can I make the services on all servers to talk to each other and
ensure that only one is processing?
Are there any .NET or Windows OS specific facilities I could utilize?

Thank you.
-Oleg.
 
Oleg,

you could use a WaitHandle subclass. As WaitHandles can be used accross
appDomains it could work for your scenario.

Regards,
Tasos
 
Back
Top