I use mutex to make sure that only one instance of my program is running on a server.
Mutex mutex = new Mutex(false, Common.MutexName);
if (!mutex.WaitOne(1000, false))
{
Console.WriteLine("Another process is already working.");
return;
}
It works in most cases, but randomly I do see multiple instances of same application were running. Am I missing anything? The server is a windows 2008.