How reliable is the FileSystemWatcher in .netFramwork 4?

我只是一个虾纸丫 提交于 2019-11-26 23:14:22

问题


Has anyone used the FileSystemWatcher in framework 4 and have you encountered any problems?

i am using it in a windows service and i cant afford for it to fail.

I have heard from a friend that it is not very reliable but I have been testing for a few hours now and i havent had any problems but i am still doubting using it.....

i would appreciate any advice on this matter, i dont want to deliver the app to the the client and then realise that this thing is going to crash....

Thanks


Thanks for the advice guys

i think for my purposes it should be ok. it will be checking a folder on the local drive of the server and all its checking for is if a file have been modified so i think it should be fine


回答1:


FileSystemWatcher relies on underlying file system support, so any reliability issues with the file system will be visible as reliability issues with FileSystemWatcher. For example, if you are watching a network directory, then the network server's reliability will affect FileSystemWatcher's reliability. For example, the server may crash and be restarted. You will not be notified of changes that take place while network connectivity is lost. Or the server may simply have a bug that prevents FileSystemWatcher from working reliably.

Another point is that FileSystemWatcher only watches for changes to metadata. Not all file changes result in changes to metadata.



来源:https://stackoverflow.com/questions/7191380/how-reliable-is-the-filesystemwatcher-in-netframwork-4

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