我有这段代码列出文件夹中的对象。
var accessKey = ConfigurationManager.AppSettings["AWSAccessKey"];
var secretKey = ConfigurationManager.AppSettings["AWSSecretKey"];
using (AmazonS3Client s3Client = new AmazonS3Client(accessKey, secretKey, RegionEndpoint.USEast1 ))
{
var prefix = string.Format(@"{0}/", uniqueKey);
ListObjectsRequest request = new ListObjectsRequest();
request.BucketName = bucketName;
request.Delimiter = "/";
request.Prefix = prefix;
do
{
ListObjectsResponse response = s3Client.ListObjects(request);
当我访问文件夹时抛出异常:
<uri>/bucketname/profile/ // Throws and exception key not found
<uri>/bucketname/profile/profile.png // This is OK
使用以下具有READ
CannedACL的路径创建图像。
<uri>/bucketname/profile//profile.png
错误
String key was not found
问题
更新 我解决了这个问题
存储桶名称不应包含
/
个字符 客户端给了我一个格式为sample/new
的存储桶名称 但真正的存储桶名称仅为sample