FileSystemWatcher stops monitoring network folder

核能气质少年 提交于 2019-12-23 17:51:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!