Marco

Marco

  • NA
  • 5
  • 0

Concurrent file write-access

Jul 1 2008 10:06 AM
Hi, I have a web service that logs some information to a text file; this web service is invoked asynchronously by a number of client apps, and this is causing a "The process cannot access the file because  it is being used by another process" error.

This is the code I am using

FileStream fs = new FileStream(filename, FileMode.Append,
_FileAccess.Write, FileShare.Write);

writer = new StreamWriter(fs);

...
writer.Close();


No other code is accessing that file. Am I missing something?


Answers (4)