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

查看:25
本文介绍了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.dll 2.0.0.0 来自 Windows Azure Storage NuGet 包,现在可以使用了.

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天全站免登陆