VB.NET service in a clustered environment
Hi
I have a windows VB.NET service that works perfectly on a normal standalone server. However when installed in clustered environment (2 machines) it seems to be fired twice.
I initiate a timer in the OnStart event and when a particular file is detected in a specific folder I execute some actions. It appears that both machines attemt to start the action since I get two log entries for the start action. Is there any special code I should include in my service to silently exit of the service has already started by the second machine of the cluster, may be something similar to
VB Code:
If App.PrevInstance Then
Exit Sub
End Sub
that I would include in a VB6 executable.
Thanks
Re: VB.NET service in a clustered environment
Could you just check for running processes? If the process of that service already exist, then don't run.
Re: VB.NET service in a clustered environment
benmartin101, thanks. I googled and it seems that I have to use the Cluster API to make my service cluster aware. I'm looking for links to specific articles and if possible code samples. I'm still googling for this Cluster API thing ....
Re: VB.NET service in a clustered environment
Geez, I hate having to do that. A customer once asked to make one of our products cluster-aware. We told'em that getting a fault-tolerant server would cost them less in terms of upfront and maintenance costs.
Re: VB.NET service in a clustered environment
Well I found Server Cluster WMI provider from MSDN help, I'll read it tomorrow at the office and give it a try.