I'm having a service (C# service) that runs on multiple computers and share the same file (on a network storage say NAS). I want to make sure that when performing a write operation, I should be able to acquire a lock on the file, write and then unlock it.
How can I lock a file on network, when writing to it ?
Take a look at
FileStream.Lock Method and FileStream.Unlock Method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With