473,790 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemWatch er file name error

I have a Windows service that use a FileSystemWatch er
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.

Nov 16 '05 #1
2 2061
Phil,

Can you show some code which shows how you are accessing the file? Is
it possible you are not closing some handles to the files that you are
trying to access perhaps?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Phil396" <an*******@disc ussions.microso ft.com> wrote in message
news:97******** *************** *****@phx.gbl.. .
I have a Windows service that use a FileSystemWatch er
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.

Nov 16 '05 #2
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 BCEfileSystemWa tcher_Created
(object sender, System.IO.FileS ystemEventArgs e)
{

string myFileName = e.FullPath;
objProductEvent s.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.co m

"Phil396" <an*******@disc ussions.microso ft.com> wrote in messagenews:97******* *************** ******@phx.gbl. ..
I have a Windows service that use a FileSystemWatch er
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.

.

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3890
by: Ron | last post by:
I am trying to run asp.net pages. The server is accessed via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I get the following error: Invalid file name for monitoring: 'E:\'. File names for monitoring must have absolute paths, and no wildcards. Description: An unhandled exception occurred during the
0
1485
by: simpsoro | last post by:
I am trying to run asp.net pages. The server is accessed by students via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I get the following error: Invalid file name for monitoring: 'E:\'. File names for monitoring must have absolute paths, and no wildcards. Description: An unhandled exception occurred during the
0
283
by: Phil396 | last post by:
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...
2
3423
by: David Meier | last post by:
Hi all, I know, windows does not care about cases in file names, however, I need to get the file name returned from the FileSystemWatcher case sensitive. Does anyone know a workaround to this bug (at least that's what I think)? Thanks. Dave
0
1621
by: Ron Simpson | last post by:
I am trying to run asp.net pages. The server is accessed via http://sitename/username I have verified it is using port 80 and aspx extensions are configured. But when I run and asp.net page I get the following error: Invalid file name for monitoring: 'E:\'. File names for monitoring must have absolute paths, and no wildcards. Description: An unhandled exception occurred during the
4
7958
by: carmelo | last post by:
Hi! I need to read and store data from a file, but I don't the name of it; Is this code correct and is there a better way to do this thing?? int main() { cout << " type file name:" char * name; cin >name;
185
7137
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will return the file name given a FILE *. Questions: What would be the best name for this function?
4
4118
rahulephp
by: rahulephp | last post by:
i think i am missing something in the below script: It shows error an do not upload files to destination: Let me know how to solve this: <?php if (isset($_POST)) { $uploadArray= array();
4
2957
by: liberty1 | last post by:
Hi everyone. I appreciate your effort at helping newbies like me. I have the following problems and will appreciate urgent help. PROBLEM NUMBER 1: Using PHP and MySQL, I am able to upload picture successfully unto the server but not so with the file name of the picture even though other parameters in my form got inserted successfuly in the database. I have read several posts on this topic including here on this site but I can't get around...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10413
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.