The lock statement ensures that one thread does not enter a critical section of code while another thread is in the critical section. However, it won\'t work if the workload is
There is nothing in .Net that can natively support cross-machine locking.
The standard method is to move the responsibility for such things to a single place, possibly a web service (not load balanced!), so it can still be called from multiple locations. Or alternatively, defining a single resource, that's accessible by all (eg database) and using this as the single resource to acquire (eg write key in locks table, if key exists lock cannot be acquired until row removed)