Hi all,
I developped an C# app which is using FileSystemWatch er. If a file is
created in a specific folder, it opens the file and does some processing.
This functionality works without problems in the following scenarios:
In a Winform App, pointing at a Local Folder
In a Winform App, pointing at a mapped network Folder
In a Winform App, pointing at a UNC network location
In a Windows Service pointing at a local Folder.
I get an System.Argument Exception in system.dll with Additional Information:
The directory name H:\... is invalid when I run the same thing as a Service
looking at a network drive (mapped or using an UNC). I use the same Network
Folder I used in the above scenarios. I doesn't make a difference if I start
it as a User Service or a Local System or anything else.
This is the FileWatcher Code:
this.fileSysWat cher = new System.IO.FileS ystemWatcher();
((System.Compon entModel.ISuppo rtInitialize)(t his.fileSysWatc her)).BeginInit ();
this.fileSysWat cher.EnableRais ingEvents = true;
this.fileSysWat cher.NotifyFilt er = ((System.IO.Not ifyFilters)
((((((((System. IO.NotifyFilter s.FileName |
System.IO.Notif yFilters.Direct oryName)
| System.IO.Notif yFilters.Attrib utes)
| System.IO.Notif yFilters.Size)
| System.IO.Notif yFilters.LastWr ite)
| System.IO.Notif yFilters.LastAc cess)
| System.IO.Notif yFilters.Creati onTime)
| System.IO.Notif yFilters.Securi ty)));
this.fileSysWat cher.Path = "H:\\MyFold er";
this.fileSysWat cher.Created += new
System.IO.FileS ystemEventHandl er(this.fileSys Watcher_Created );
Any ideas? Thank you for taking the time.
Cheers
Peter 1 5875
Update: We (as in my team mate - and I was watching:-) are one step closer.
it now works with a fully qualified network UNC i.e.
//machinename.dom ain.topleveldom ain/sharename
Still no success with a mapped drive, though. But hey, I can live with the
fully qulified UNC.
Cheers
Peter
"PeterNZ" wrote: Hi all,
I developped an C# app which is using FileSystemWatch er. If a file is created in a specific folder, it opens the file and does some processing.
This functionality works without problems in the following scenarios: In a Winform App, pointing at a Local Folder In a Winform App, pointing at a mapped network Folder In a Winform App, pointing at a UNC network location In a Windows Service pointing at a local Folder.
I get an System.Argument Exception in system.dll with Additional Information: The directory name H:\... is invalid when I run the same thing as a Service looking at a network drive (mapped or using an UNC). I use the same Network Folder I used in the above scenarios. I doesn't make a difference if I start it as a User Service or a Local System or anything else.
This is the FileWatcher Code: this.fileSysWat cher = new System.IO.FileS ystemWatcher(); ((System.Compon entModel.ISuppo rtInitialize)(t his.fileSysWatc her)).BeginInit (); this.fileSysWat cher.EnableRais ingEvents = true; this.fileSysWat cher.NotifyFilt er = ((System.IO.Not ifyFilters) ((((((((System. IO.NotifyFilter s.FileName | System.IO.Notif yFilters.Direct oryName) | System.IO.Notif yFilters.Attrib utes) | System.IO.Notif yFilters.Size) | System.IO.Notif yFilters.LastWr ite) | System.IO.Notif yFilters.LastAc cess) | System.IO.Notif yFilters.Creati onTime) | System.IO.Notif yFilters.Securi ty))); this.fileSysWat cher.Path = "H:\\MyFold er"; this.fileSysWat cher.Created += new System.IO.FileS ystemEventHandl er(this.fileSys Watcher_Created );
Any ideas? Thank you for taking the time.
Cheers
Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ron King Jr |
last post by:
I have a small problem with my windows service. The first time I start the service everything works the way it's suppose to, but randomly the service fails. The jist of the service is to use the filewatcher component to watch a directory. On create only, the service will read the small XML file, process the information. Once the file is finished processing the information, it should copy the file to another directory and delete the original....
|
by: PeterNZ |
last post by:
Hi all,
I developped an C# app which is using FileSystemWatcher. If a file is
created in a specific folder, it opens the file and does some processing.
This functionality works without problems in the following scenarios:
In a Winform App, pointing at a Local Folder
In a Winform App, pointing at a mapped network Folder
In a Winform App, pointing at a UNC network location
In a Windows Service pointing at a local Folder.
|
by: Troy Murphy |
last post by:
I seem to remember using a walkthru in the early beta that demonstrated how
to create a Windows Service that would monitor events in a folder.
Can someone please direct me to an example of doing this?
Thanks,
Troy
|
by: bivin |
last post by:
hai
i am requesting your technical support.
please help me.
i have been working with this for five days.
the problem is relating with the smtp.
i am trying to send an email from the asp.net page.
earlier it was showing send using not find error.
|
by: Luis Esteban Valencia Muñoz |
last post by:
Hi everyone,
I created a VB.NET application that looks at a folder
in my local system from which I can read the file, enter data into the
database and delete the file. I am using the filewatcher class.. However I
need to do the same with ASP.NET. I want this application to be running all
the time and I want the changes to be reflected on the ASP.NET page i.e the
graphs on the ASP.NET page reflect the data that is being entered in the...
| |
by: Jason |
last post by:
I created a FileWatcher service to watch a folder. When a new file is
created in the folder, I want to start a process.
Everything works fine if I cut-and-paste a test file from my hard-drive; as
soon as the file is pasted the service notices, the called process fires and
a series of events occurs.
HOWEVER, if I copy a test file from my CD-ROM drive, nothing happens! WTF?
The called process involves moving the file, so I thought maybe...
|
by: Dave |
last post by:
I've been given the task at work to create a page for the internet.
Great, I've never done that before! So I start building. Looks
good...flows good...works great internally on the domain, so I put it
out for testing. Our production envirnment for this page is totally
independent of our company domain. All User Accounts will stay in an
MDF that resides with the Web Page.
Since I'm dealing with SQL Express now, I'm not sure what's...
|
by: tshad |
last post by:
Is there some way to have the fileWatcher to initially check the folder to
see if there is anything in it (based on the filters)?
If I reboot the machine, for example, and it starts up the service - I would
like it to look at the folder initially. The reason being that I may bring
the system down and at that point the files may be written to the target
directory. When I bring it back up again and the service starts, it won't
see that...
|
by: tshad |
last post by:
I have a filewatcher program that is working syncronously (which is how I
want it to work).
But my program will handle whatever files are in the folder at the time it
runs. So when I drop 15 files in the folder at once, the event kicks of 15
times - even though all the files were processed in the 1st event.
This is fine, it just won't find any files in the folder for 14 times.
But if I drop 600 files in the folder at once, it will...
|
by: tshad |
last post by:
What exactly is FileWatcher doing? When you drop 100 files in a folder it
is watching, it normally will fire of the event 100 times.
In my case, I do all my processing on the first event so I don't need to
reinitialize all my variables for each file. Normally 50 - 100 files will
be dropped in the folder at a time.
If I get an error, in my code it moves out to my try/catch code in the
service - handle it and then exit. Then the next...
|
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...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |