[ACCEPTED]-The process cannot access the file because it is being used by another process-c#

Accepted answer
Score: 83
using (FileStream fs = 
    new FileStream(filePath,
        FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
//...

http://msdn.microsoft.com/en-us/library/system.io.fileshare.aspx

Your log may be write locked, so try with 1 FileShare.ReadWrite.

Score: 17

Try to add the FileShare option, see if 3 that helps:

FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

EDIT: corrected code, not FileShare.Read but 2 FileShare.ReadWrite does the trick (as Guillaume showed as 1 well). The reason: you want to open your file and allow others to read and write it at the same time.

More Related questions