FileSystemWatcher 停止监视网络文件夹
我开发了文件队列系统,其中来自不同 Windows 计算机的多个应用程序监视相同的映射网络驱动器以进行文件更改并处理文件。为了监视映射驱动器的更改,我使用 FileSystemWatcher (c# .NET 4.0),在 FileSystemWatcher 停止监视后的一天内一切正常。我尝试使用 FileSystemWatcher.Error 事件来捕获异常(如果有)。不幸的是错误事件并不总是被触发。我没有找到解决问题的方法,FileSystemWatcher 停止工作并且没有抛出错误。有什么建议吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
FileSystemWatcher
对于网络驱动器来说并不可靠...例如,已知它在 SAMBA 共享方面存在一些问题...另一点是,如果您在 Windows 服务中使用它...尝试访问来自 Windows 服务的网络驱动器通常会导致一些问题(取决于 Windows 版本等)。
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.).
网络断开。这是自然的。
看看这里:http://www.codeguru.com /csharp/.net/net_general/eventsanddelegates/article.php/c9113
祝你好运
Networks gets disconnected. It's natural.
Have a look here: http://www.codeguru.com/csharp/.net/net_general/eventsanddelegates/article.php/c9113
Good luck