有名mutex:
static Mutex m;
private void WebMethod()
{
bool requestInitialOwnership = true;
bool mutexWasCreated;
m = new Mutex(requestInitialOwnership,
"MyMutex",
out mutexWasCreated);
if (!(requestInitialOwnership && mutexWasCreated))
{
Console.WriteLine("Waiting for the named mutex.");
.....
}
//do work
}