Got strange System.IO.IOException - "... cannot be performed on a file with a user-mapped section op

  • Thread starter Thread starter dejanvesic
  • Start date Start date
D

dejanvesic

Hello.

Windows service is in question, Framework 2.0, operating system is
Windows XP Prof.

Windows service is accessing file taking turns with ASP.NET
application.

For synhronisation of file access, I used named Mutex.

It works fine, but I got two times already error message:

System.IO.IOException was unhandled
Message="The requested operation cannot be performed on a file with a
user-mapped section open.\r\n"
Source="mscorlib"

Code fragment looks like this:

mutex.WaitOne();
....

XmlSerializer s = new XmlSerializer(typeof(List<Cabinet>));

using (StreamWriter w = new
StreamWriter(fileNameOfStorage)) /* Failed here */
{
s.Serialize(w, Cabinets);
w.Close();
}

mutex.ReleaseMutex();

I failed to find additional info about this message.

Any ideas?

Regards,
Dejan
 
Back
Top