|
System.IO.FileSystemWatcher - permissions required for watching
Hi - looking for help answering a question that's bugging me. I have developed a Windows service that watches directories using the System.IO.FileSystemWatcher object. The directory to watch is set via the config file for the service. The Windows service runs under an account that's a member of the Administrators group on the machine it's installed to.
The problem is getting the FileSystemWatcher to watch a directory that's on another machine in the same domain. When the directory to watch is on another machine, the Windows service throws an invalid directory Exception. This is because the service doesn't have the required permissions on the other machine.
I thought there might be 2 ways to solve this.
1. Make the account the Windows service runs under a member of the Administrators group on the other machine. OR
2. Give the account the Windows service runs full control over the directory on the other machine.
The first solution works (making the account an Administrator). The second, which is my preferred solution because it involves a more limited set of permissions, doesn't. I can't understand why not. Why wouldn't you be able to have a FileSystemWatcher watch a directory on another machine that you have full control over?
Can anyone shed some light on this?
|