Azure 执行DownloadToFIleParallelAsync方法时出现问题
我正在尝试使用DownloadToFIleParallelAsync方法将azure blob下载到本地文件中,以减少下载所需的时间。但是当那一行执行时,我的程序继续执行。在执行该行之后没有任何语句。这是我写的代码Azure 执行DownloadToFIleParallelAsync方法时出现问题,azure,azure-storage-blobs,Azure,Azure Storage Blobs,我正在尝试使用DownloadToFIleParallelAsync方法将azure blob下载到本地文件中,以减少下载所需的时间。但是当那一行执行时,我的程序继续执行。在执行该行之后没有任何语句。这是我写的代码 using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Th
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
namespace demoAzure {
class Program
{
static void Main(string[] args)
{
var watch = System.Diagnostics.Stopwatch.StartNew(); Console.WriteLine("Downloading..."); ProcessBlob().GetAwaiter().GetResult();
watch.Stop();
Console.WriteLine( "Execution Time: " + watch.ElapsedMilliseconds + " Milliseconds");
Console.ReadLine();
}
private static async Task ProcessBlob()
{
string storageconnectionstring = Environment.GetEnvironmentVariable("storageconnectionstring"); CloudStorageAccount storageAccount = null;
CloudBlobContainer container = null;
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string blobName = "large rfa_15mb.RFA";
string downloadFilePath = Path.Combine(folderPath, blobName);
if (CloudStorageAccount.TryParse(storageconnectionstring, out storageAccount)) {
try
{
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); container = blobClient.GetContainerReference("blobcontainer"); await container.CreateIfNotExistsAsync();
CloudBlockBlob blob = container.GetBlockBlobReference(blobName); //await blob.DownloadToFileAsync(downloadFilePath, FileMode.Create);
await blob.DownloadToFileParallelAsync(downloadFilePath, FileMode.Create, 2, 4 * 1024 * 1024);
// blob.DownloadToFile(downloadFilePath, FileMode.Create); Console.WriteLine("completed");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
else
{
Console.WriteLine("No system environment variables are available. please set one");
}
}
} }
隐马尔可夫模型。。。听起来像是异步等待死锁:/n如果有同步版本,你可以使用它,因为你无论如何都是从控制台应用程序运行它,而异步实际上没有任何好处,因此没有任何同步版本的并行下载。我想提高下载速度。我尝试过使用区块下载,但影响不大