简体   繁体   English

能够上传,下载和删除,但不能在Azure Blob容器中列出

[英]Able to upload, download, and delete but not list in Azure Blob Container

I have a service in C# where I try to list all the files in a directory. 我在C#中有一项服务,在该服务中我尝试列出目录中的所有文件。

CloudBlobDirectory dir = container.GetDirectoryReference(path);
var res = await dir.ListBlobsSegmentedAsync(continuationToken); <-- Error is thrown on this line

I have confirmed that the directory exists, that the path is correct, and that it has files in it. 我已经确认该目录存在,路径正确,并且其中包含文件。

However, I'm getting this error: The requested URI does not represent any resource on the server. 但是,我收到此错误: The requested URI does not represent any resource on the server.

I am accessing the blob with a SAS key that has all permissions (read, write, delete, list). 我正在使用具有所有权限(读取,写入,删除,列出)的SAS密钥访问Blob。 Listing files works perfectly fine when I use the storage emulator, but not when I'm connected to an actual azure resource. 当我使用存储模拟器时,列出文件可以很好地工作,但是当我连接到实际的Azure资源时,清单文件工作得很好。 What could be the issue? 可能是什么问题?

Turns out I can only list when I have account-level access, instead of container-level like what I had before. 原来,我只能在具有帐户级别的访问权限时列出,而不能像以前那样列出容器级别的访问权限。 I generated a new SAS key off the Azure portal, for https://<accountname>.blob.core.windows.net/ instead of https://<accountname>.blob.core.windows.net/<containername> , and was able to list. 我在Azure门户上为https://<accountname>.blob.core.windows.net/而不是https://<accountname>.blob.core.windows.net/<containername>生成了一个新的SAS密钥,并能够列出。 I have no idea why as this wasn't written in the docs anywhere. 我不知道为什么,因为这没有写在文档的任何地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM