I am using C# filesystemwatcher to monitor a folder for new files that are generated from two web sites running on the same machine. Sometimes new files trigger my event handler and sometimes they do not.
FileSystemWatcher watcher = new FileSystemWatcher
{
Path = "c:/inetpub/websites/site1/PDF/Source",
NotifyFilter = NotifyFilters.LastWrite,
Filter = "*.*"
};
watcher.Changed += new FileSystemEventHandler(OnNewFileCreated);
watcher.EnableRaisingEvents = true;
When I examine the properties of the new files, the only real difference is the Details->Owner which are set to the web site names.
The files from site1 are processed, but the files with site2 are not. I can copy and paste the site2 file in explorer and then it is acted on.
I can try moving the folder to a c:/temp folder but this did not make much sense to do so.
Are there any ideas on what is going on? Any tips will be appreciated.
Thanks - Steve
NotifyFilters.FileNameto the filter? Do both acutally save files in the same exact folder, or some subfolder? If that's the case, add.IncludeSubdirectories = truewatchertoErrorevent and log error, maybe it will help to understand the issue. And if I do not mistake, after any error infswhe must be recreated, because it will stop firing events