自动刷新WebApplication中的文件或目录 [英] Auto refresh file or directory in WebApplication
问题描述
我们使用树状视图显示Web应用程序中C:\驱动器中的所有文件和目录.现在,我们要求目录/文件列表在树中任何文件发生更改时都可以智能刷新.我们如何在Web应用程序中实现这一目标?
We are using a tree view to display all the files and directories in C:\ drive in our web application.Now we have requirement for the directory / file list to intelligently refresh whenever any file changes in the tree. How can we achieve this in Web Application ?
推荐答案
这有点棘手.首先,您将需要实施长轮询或按Push来实现当今流行的称呼.其他方法是轮询,但是轮询很糟糕..Net有一个很好的异步信令框架,称为 SignalR
This one is a bit tricky. First of all you will want to implement long polling or Push how it's popular to call it nowadays. Other way is polling, but polling sucks. There is a good async signaling framework for .Net called SignalR
第二,您要使用 FileSystemWatcher 监视您的文件夹.
Secondly you'd want to use FileSystemWatcher to monitor your folders.
享受:)
这篇关于自动刷新WebApplication中的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!