问题
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?
回答1:
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.).
回答2:
Networks gets disconnected. It's natural.
Have a look here: http://www.codeguru.com/csharp/.net/net_general/eventsanddelegates/article.php/c9113
Good luck
来源:https://stackoverflow.com/questions/7818545/filesystemwatcher-stops-monitoring-network-folder