It is necessary to open the file that I enter, but get a file lock exception

Hello,

I am using LOG4NET to enter a txt file. However, one of my forms needs to open a txt file (using streamreader) in order to read the contents and display them in a TXT file. However, I continue to get an exception stating that the file is locked by another process.

Is there a way to do this in LOG4NET?

thanks

+4
source share
2 answers

If you open a log file with the ReadWrite exchange enabled (FileShare.ReadWrite), it will probably work.

You can always use the Process Monitor from http://www.sysinternals.com to see what happens.

+3
source

Source: https://habr.com/ru/post/1346878/


All Articles