Environment: 3 web services 2 in one pool 1 in another application pool.
They all have the same code trying to access something that is not thread safe โ the file they write.
I am trying to block this code the same way for every web service. I am not sure if the lock keyword does what I want.
One lock I'm trying to make is in every web service:
string stringValue lock (stringValue)
Another lock attempt:
lock (typeof(MyWebServiceClass))
Will these locks prevent writing to the file at the same time during use? In this case, several clients fall into each of these web services.
source share