“The process cannot access the file because it is being used by another process” with Images

前端 未结 7 1039
梦毁少年i
梦毁少年i 2020-12-04 02:02

I\'ve seen many issues like this that have been solved and the problem was mostly due to streams not being disposed of properly.

My issue is slightly different, here

7条回答
  •  感动是毒
    2020-12-04 02:17

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

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

提交回复
热议问题