There sure is!

MSDN Library says that FileShare.Read "Allows subsequent opening of the file for reading".

If you change this to FileShare.ReadWrite ("Allows subsequent opening of the file for reading or writing"), you might have better luck!

/Göran


On Feb 18, 2008 4:45 AM, Beyers Cronje <[EMAIL PROTECTED]> wrote:
Hi all,

Quick question. I am using a RollingLogFileAppender on a webservice. Logging works 100%, but whenever I try to open the log file for reading in another process I get a sharing violation on the log file. I open the file with:

FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);

Would I have to enable MinimalLock, or is there a way to use ExclusiveLock and have another process read from the log file ?

Kind regards

Beyers Cronje


Reply via email to