Pav*_*van 5 azure azure-storage
任何人都可以告诉我,为什么我们不能在天蓝色存储中的容器内创建一个容器?还有什么方法可以处理,我们需要在azure存储中创建目录层次结构?
San*_*tia 14
您无法在容器中创建容器,因为Windows Azure根本不支持层次容器(您应该将容器视为'磁盘驱动器',就像C:\ disk一样).但是通过CloudBlobDirectory类支持使用目录.以下是Neil博客的一个例子:
protected void GetDirectoryList(String topLevelDirectoryName, String subDirectoryName)
{
CloudStorageAccount cloudStorageAccount =
CloudStorageAccount.FromConfigurationSetting(“DataConnectionString”);
CloudBlobClient cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
CloudBlobDirectory topLevelDirectory = cloudBlobClient.GetBlobDirectoryReferencetopLevelDirectoryName);
CloudBlobDirectory subDirectory = topLevelDirectory.GetSubdirectory(subDirectoryName);
IEnumerable<IListBlobItem> blobItems = subDirectory.ListBlobs();
foreach (IListBlobItem blobItem in blobItems)
{
Uri uri = blobItem.Uri;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1597 次 |
| 最近记录: |