473,804 Members | 3,649 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 2063
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
3894
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
1626
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
7959
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
7143
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
4119
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
2960
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
9569
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10318
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...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7608
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
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2975
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.