"File is being used by another process" - error

G

Goran Djuranovic

Hi all,
I was getting this error when trying to move files on a FileSystemWatcher
notification (with in a Windows Service). To fix this, I implemented a
FileWaiter class to wait for the file to be ReadWrite accessible, and that
worked fine on two PCs (Windows XP Pro SP2 & Windows XP Pro). But when I
tried this on my third PC that had Windows XP Pro SP1 installed, it would
not work. The file that was copied to folder was never accessible, after
being seen by a FSW. It looks like something was keeping a handle on it, but
I couldn't figure out what. Could it be some weird setting on Windows XP,
such as "Simple File Sharing"?

Any ideas?

Thanks
Goran
 
W

Walter Wang [MSFT]

Hi Goran,

You can use FileMon (http://www.sysinternals.com/Utilities/Filemon.html) to
find which process is opening the file: menu "Find/Find Handle..." and type
in the file name. This will list which processes are accessing the file.

Also, if you could decribe more your program logic or post some code, we
may have a clearer understanding of the problem.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Goran Djuranovic

Hi Walter,
The problem seems to have disappaered, after I rebooted the machine
yesterday. I will re-post if it happens again. Thanks for the link on
FileMon.

Goran
 

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

Top