Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 838
Tomas Avatar asked Oct 10 '22 17:10

Tomas


2 Answers

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.).

like image 105
Yahia Avatar answered Oct 13 '22 11:10

Yahia


Networks gets disconnected. It's natural.

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

Good luck

like image 22
Jonas Rembratt Avatar answered Oct 13 '22 10:10

Jonas Rembratt