It is a threading problem. I step through the program
line by line and everything worked fine. I am trying
some way to use thread sleep to slow down that application
if this exception occurs
private void BCEfileSystemWatcher_Created
(object sender, System.IO.FileSystemEventArgs e)
{
string myFileName = e.FullPath;
objProductEvents.ReadAllEvents(myFileName);
}
-----Original Message-----
Phil,
Can you show some code which shows how you are
accessing the file? Isit possible you are not closing some handles to the
files that you aretrying to access perhaps?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Phil396" <an*******@discussions.microsoft.com> wrote in
messagenews:97****************************@phx.gbl... I have a Windows service that use a FileSystemWatcher
to scan incoming html for information. The process
worked fine in a Windows Application and it also
works fine in a Windows Service except when you try
to process the same file name twice. I get the generic
problem "file is being used by another process". What
is really stange is it will report the same
problem when the name is different but the first 10
letters are the same. I have seen some people who
have had similar problems use thread sleep but I do
not believe that will help me in anyway since the
problem only occurs if I try to use the same file name.
.