O
Oscar Bowyer
I've recently discovered a new failure mode for the FileSystemWatcher class.
I'm using FSW in a service to watch and process files in the watched
directory.
The watcher service is running on a different physical machine from the
watched folder.
If the machine with the watched directory is rebooted, the FSW looses its
connection and no longer receives events.
I was looking for an event that would indicate the watched directory had
been disconnected so that the service could attempt to reconnect. No luck.
There is an OnError event, but the docs say that it is fired when the buffer
is overrun.
The only solution I've found is to run the FSW service on the watched
machine. This way the service restarts with the machine.
Anyone using a FSW service to watch different machines needs to consider
this.
I'm using FSW in a service to watch and process files in the watched
directory.
The watcher service is running on a different physical machine from the
watched folder.
If the machine with the watched directory is rebooted, the FSW looses its
connection and no longer receives events.
I was looking for an event that would indicate the watched directory had
been disconnected so that the service could attempt to reconnect. No luck.
There is an OnError event, but the docs say that it is fired when the buffer
is overrun.
The only solution I've found is to run the FSW service on the watched
machine. This way the service restarts with the machine.
Anyone using a FSW service to watch different machines needs to consider
this.