如何在c#中暂停/恢复从Azure Blob下载文件? [英] How to Pause/Resume file download from Azure Blob in c# ?

查看:87
本文介绍了如何在c#中暂停/恢复从Azure Blob下载文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,可将重要的数据/文件备份到压缩的zip文件中,并将其上传到Azure Blob容器.此外,只要需要,用户就可以通过本地下载来查看这些上载的文件.我们开发了一个Storage Explorer实用程序 使用哪个用户下载文件.但是现在我想向浏览器添加一个新功能,即:暂停/恢复或取消下载.用户应该可以单击按钮来暂停/恢复或取消下载.

I have a project which backups important data/files into a compressed zip file and upload it to Azure Blob container. Further whenever required user can view these uploaded files by downloading locally. We have developed a Storage Explorer utility using which user downloads the files. But now I want to add a new feature to the explorer and that is: Pause/Resume or Cancel the download. User should be able to Pause/Resume or Cancel the download on a click of a button.

Storage Explorer是作为WPF(Xaml)应用程序开发的.用户选择一个特定的文件,然后单击下载"以下载它.因此,如果发生任何错误或存在任何网络连接问题,用户将暂停下载,更正错误,然后将 从暂停的同一阶段恢复下载.简历不应从头开始下载.

Storage Explorer is developed as a WPF (Xaml) application. User selects a particular file and click on Download to download it. So if any error occurs or there is any network connectivity issue, user will pause the download, correct the error and then will resume the download from the same stage where it was paused. Resume should not start the download from the start.

任何人都可以指导我如何实现Azure Blob的暂停/恢复下载.快速响应将不胜感激.

Could anyone please guide me on how to achieve the Pause/Resume download of Azure Blobs. A quick response will be appreciated.

预先感谢.

MB

推荐答案

你好,

我不熟悉Azure,但是您的方法很容易实现.

 I am not versed with Azure but your methodology is fairly straight forward to implement.

服务器必须知道如何处理多块下载请求和批量下载请求.这些条款

The Server must know how to handle multi-block vs bulk download requests.  These terms

超出了套接字处理数据包的方式.您将需要允许的代码

are outside the way Sockets handle data packets.  You will need code that will allows for

RX/TX,类似于随机访问.您希望客户端请求Block [n]和服务器

RX/TX that is like Random Access.  You want the Client to ask for Block[ n ] and the Server

发送.然后,如果出现暂停,则客户端/服务器都将知道已发送的内容以及发送到何处

sends. Then if there is a Pause, both the Client/Server know what has been sent and where

继续.我知道它似乎没有帮助,但是我所能提供的一切

to Resume. I know it does not seem helpful but its about all I can provide with my knowledge

Azure的

 谢谢:)


这篇关于如何在c#中暂停/恢复从Azure Blob下载文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆