"file in use" from XmlDocument.Load

G

Guest

I have a web application that saves/loads XML documents. On occasion, an
error is logged on the call to XmlDocument.Load: "process cannot access the
file <filepath here> because it is being used by another process." Why
should a document read operation have any sort of locking issues - even if
two users are attempting to read the file at the same time, this should not
be a problem. I don't think this is happening at the same time as a call to
XmlDocument.Save on the file either, so I don't believe that is the issue
(though I'm not sure why that would be a problem in any case).

The same error has also been raised when trying to load an XML document by
the application after a new version of the XML file was uploaded via FTP to
the web server. (The XML document is saved in the application Cache and is
automatically reloaded when the file changes using the cache dependency
functionality.)

Any help on this issue would be appreciated - I have searched many different
forums and web sites but have not yet found an answer.

EK
 
V

vMike

ek03 said:
I have a web application that saves/loads XML documents. On occasion, an
error is logged on the call to XmlDocument.Load: "process cannot access the
file <filepath here> because it is being used by another process." Why
should a document read operation have any sort of locking issues - even if
two users are attempting to read the file at the same time, this should not
be a problem. I don't think this is happening at the same time as a call to
XmlDocument.Save on the file either, so I don't believe that is the issue
(though I'm not sure why that would be a problem in any case).

I had a similar problem. It turned out that the file was being lock at the
time of the FTP load. I solve the problem by adding a small routine to put
the put the process to sleep for a few seconds if the file is in the process
of upload, then retry the operation. Hope this helps.
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top