Author: goodmorningsky | Posted on: 11/10/2010 7:51:43 PM | Views : 1545

Hello,
I logs error from  Global.Application_Error method.
File.AppendAllText method is used to write message to file with thread safe way using Monitor.
However, I keep having the following error
"The process cannot access the file 'D:\Projects\FPS\PPS\Log\201011.txt' because it is being used by another process."

The file was just created by ASP.NET. When next request writes message to the same file, it cause the issue.
If I test after while like 5 min, it doesn' t have problem. But, if I test again after 1 second, the file is locked.
 
What's wrong with it?
 
   Public Class MyExceptionHandl ...

Go to the complete details ...