G
Guest
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.
I get an System.ArgumentException 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.fileSysWatcher = new System.IO.FileSystemWatcher();
((System.ComponentModel.ISupportInitialize)(this.fileSysWatcher)).BeginInit();
this.fileSysWatcher.EnableRaisingEvents = true;
this.fileSysWatcher.NotifyFilter = ((System.IO.NotifyFilters)
((((((((System.IO.NotifyFilters.FileName |
System.IO.NotifyFilters.DirectoryName)
| System.IO.NotifyFilters.Attributes)
| System.IO.NotifyFilters.Size)
| System.IO.NotifyFilters.LastWrite)
| System.IO.NotifyFilters.LastAccess)
| System.IO.NotifyFilters.CreationTime)
| System.IO.NotifyFilters.Security)));
this.fileSysWatcher.Path = "H:\\MyFolder";
this.fileSysWatcher.Created += new
System.IO.FileSystemEventHandler(this.fileSysWatcher_Created);
Any ideas? Thank you for taking the time.
Cheers
Peter
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.
I get an System.ArgumentException 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.fileSysWatcher = new System.IO.FileSystemWatcher();
((System.ComponentModel.ISupportInitialize)(this.fileSysWatcher)).BeginInit();
this.fileSysWatcher.EnableRaisingEvents = true;
this.fileSysWatcher.NotifyFilter = ((System.IO.NotifyFilters)
((((((((System.IO.NotifyFilters.FileName |
System.IO.NotifyFilters.DirectoryName)
| System.IO.NotifyFilters.Attributes)
| System.IO.NotifyFilters.Size)
| System.IO.NotifyFilters.LastWrite)
| System.IO.NotifyFilters.LastAccess)
| System.IO.NotifyFilters.CreationTime)
| System.IO.NotifyFilters.Security)));
this.fileSysWatcher.Path = "H:\\MyFolder";
this.fileSysWatcher.Created += new
System.IO.FileSystemEventHandler(this.fileSysWatcher_Created);
Any ideas? Thank you for taking the time.
Cheers
Peter