Tomas
Tomas

Reputation: 18117

FileSystemWatcher stops monitoring network folder

I have developed file queue system, where several Apps from different Windows machines watch the same mapped network drive for file changes and proceed files. To watch mapped drive for changes I use FileSystemWatcher (c# .NET 4.0) and everything works fine for ~one day after that FileSystemWatcher stops monitoring. I have tried to play with FileSystemWatcher.Error event to catch exceptions if any. Unfortunately Error event is not always fired. I do not find a way to solve the problem, FileSystemWatcher stops working and no error are throw. Any suggestion?

Upvotes: 5

Views: 6963

Answers (2)

Jonas Rembratt
Jonas Rembratt

Reputation: 1752

Networks gets disconnected. It's natural.

Have a look here: http://www.codeguru.com/csharp/.net/net_general/eventsanddelegates/article.php/c9113

Good luck

Upvotes: 1

Yahia
Yahia

Reputation: 70379

FileSystemWatcher is NOT reliable for network drives... for example it is known to have some problems with SAMBA shares...

Another point is if you are using it in a Windows Service... trying to access a network drive from a Windows Service usually leads to some problem (depending on Windows version etc.).

Upvotes: 4

Related Questions