简体   繁体   English

文件位于其他服务器上时,.NET下载一个Zip文件

[英].NET download one Zip file when files are on different server

my users upload their files in my Web Application and the application saves their files in the server that has the most free space. 我的用户将他们的文件上传到我的Web应用程序中,该应用程序将他们的文件保存在具有最大可用空间的服务器中。 The result is that one folder of a user may contain multiple files that are saved in multiple servers. 结果是用户的一个文件夹可能包含多个文件,这些文件保存在多个服务器中。

Now i want to give my users the option to download their whole folder as a ZIP file. 现在,我想让我的用户选择将其整个文件夹下载为ZIP文件。

Can somebody provide an appropriate namespace or guidance of what will be the best practice to achieve this functionality? 有人可以提供适当的名称空间或有关实现此功能的最佳实践的指导吗?

The application is written in C# .NET. 该应用程序是用C#.NET编写的。 So far i saw 到目前为止,我看到了

1) http://msdn.microsoft.com/en-us/library/system.io.packaging.aspx 1) http://msdn.microsoft.com/en-us/library/system.io.packaging.aspx

together with 和...一起

2) http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx 2) http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx

Am i looking at the right direction? 我在寻找正确的方向吗?

Let say a user has his files over 3 servers named server1,server3 and server6 point 1. You must have those locations somewhere? 假设某个用户的文件位于3个名为server1,server3和server6点1的服务器上。您必须在某个位置放置这些位置吗? right? 对?

now suppose server7 needs to pack those files into 1 zip and stream to the client. 现在,假设server7需要将这些文件打包为1个zip并流式传输到客户端。

You will need to download all those files to server7 and then pack those files to zip archive. 您将需要将所有这些文件下载到server7,然后将这些文件打包到zip存档中。

To download the files you can use webrequest method. 要下载文件,可以使用webrequest方法。 Hope this is clear. 希望这很清楚。

YOU WILL NEED TO DOWNLOAD THE FILES TO A SINGLE LOCATION BEFORE ZIPPING THEM, there is no shortcut over this. 在压缩文件之前,您将需要将文件下载到单个位置,没有捷径可走。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM