Azure blob download to stream有错误

时间:2018-03-27 11:18:14

标签: azure azure-storage-blobs

我正在尝试将Azure blob下载到MemoryStream,我收到错误“'memoryStream.ReadTimeout'引发了类型'System.InvalidOperationException'的异常”。但我可以下载到文件。

代码段位于

之下
private static void GetExcelBlobData(string filename, string connectionString, string containerName)
        {
            // Retrieve storage account from connection string.
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

            // Create the blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            // Retrieve reference to a previously created container.
            CloudBlobContainer container = blobClient.GetContainerReference(containerName);

            // Retrieve reference to a blob named "test.xlsx"
            CloudBlockBlob blockBlobReference = container.GetBlockBlobReference(filename);

            DataSet ds;
            using (var memoryStream = new MemoryStream())
            {
                //downloads blob's content to a stream
                blockBlobReference.DownloadToStream(memoryStream);
            }
        }

显示“blockBlobReference.DownloadToStream(memoryStream)”行上的调试控制台错误

有谁知道我在这里做错了什么?

Error in MemoryStream

0 个答案:

没有答案