What causes a FileSystemWatcher object to go stale?
I have a FileSystemWatcher that processes files based on file system events. After awhile, the process is still alive, but it no longer detects the file system events. The process watches开发者_C百科 a local network share drive.
Anything I should be watching out for?
Most likely small drops in network connectivity. Check this article.
Basically:
- set
watcher.EnableRaisingEvents = true
- add an event handler to
watcher.Error
Then re-bind on error.
I guess I better post the answer instead of leaving it in the comment: did you implement the Error event? When you do get errors, bump up the value of the InternalBufferSize property. Try 16384.
http://bytes.com/topic/visual-basic-net/answers/536125-filesystemwatcher-across-network
精彩评论