Y
Yash Ganthe
The MSDN documentation says that FSW can be used for monitoring
network paths and folders. I tried it with a simple application and
monitored \\server\share. This worked fine. I was logged in as a
domain user. The shared folder has full access granted to the domain
user.
When I use the FSW in a Win Service, the event handlers get
registered. But they are never invoked. The FSW does not respond to
the registered events. The Win service is configured to run using the
same domain user account.
The PC on which I am running the FSW and the Server, are both running
on Win XP SP2. The Win service works fine with a local folder.
This is the code:
filesystemwatcher = new FileSystemWatcher();
string pathval = ConfigurationManager.AppSettings
["pathval"];
string filterval = ConfigurationManager.AppSettings
["filterval"];
filesystemwatcher.Path = pathval;
filesystemwatcher.Filter = filterval;
filesystemwatcher.NotifyFilter =
NotifyFilters.LastAccess | NotifyFilters.LastWrite |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
filesystemwatcher.InternalBufferSize += 81920;
filesystemwatcher.IncludeSubdirectories = true;
filesystemwatcher.Created += new
System.IO.FileSystemEventHandler(fsw_Changed);
filesystemwatcher.Changed += new
System.IO.FileSystemEventHandler(fsw_Changed);
filesystemwatcher.EnableRaisingEvents = true;
What could be the problem?
Thanks,
Yash
network paths and folders. I tried it with a simple application and
monitored \\server\share. This worked fine. I was logged in as a
domain user. The shared folder has full access granted to the domain
user.
When I use the FSW in a Win Service, the event handlers get
registered. But they are never invoked. The FSW does not respond to
the registered events. The Win service is configured to run using the
same domain user account.
The PC on which I am running the FSW and the Server, are both running
on Win XP SP2. The Win service works fine with a local folder.
This is the code:
filesystemwatcher = new FileSystemWatcher();
string pathval = ConfigurationManager.AppSettings
["pathval"];
string filterval = ConfigurationManager.AppSettings
["filterval"];
filesystemwatcher.Path = pathval;
filesystemwatcher.Filter = filterval;
filesystemwatcher.NotifyFilter =
NotifyFilters.LastAccess | NotifyFilters.LastWrite |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
filesystemwatcher.InternalBufferSize += 81920;
filesystemwatcher.IncludeSubdirectories = true;
filesystemwatcher.Created += new
System.IO.FileSystemEventHandler(fsw_Changed);
filesystemwatcher.Changed += new
System.IO.FileSystemEventHandler(fsw_Changed);
filesystemwatcher.EnableRaisingEvents = true;
What could be the problem?
Thanks,
Yash