Azure存储容器大小 [英] Azure Storage container size

查看:130
本文介绍了Azure存储容器大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Azure存储中获取大小的容器?我通过C#API访问Azure存储:

How can I get a size of container in Azure Storage? I access Azure storage via C# API:

var account = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["AzureStoragePrimary"]);
var client = account.CreateCloudBlobClient();
var container = client.GetContainerReference("myContainer");

推荐答案

我已将 Microsoft.WindowsAzure.StorageClient.dll 1.1.0.0从Windows Azure SDK更新为 Microsoft.WindowsAzure.Storage Windows Azure Storage NuGet包中的.dll 2.0.0.0,现在可以使用.

I have updated Microsoft.WindowsAzure.StorageClient.dll 1.1.0.0 from Windows Azure SDK to Microsoft.WindowsAzure.Storage.dll 2.0.0.0 from Windows Azure Storage NuGet package and it works now.

long size = 0;
var list = container.ListBlobs();
foreach (CloudBlockBlob blob in list) {
    size += blob.Properties.Length;
}

这篇关于Azure存储容器大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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