列出AWS S3文件时出现错误/异常

时间:2014-02-26 12:11:19

标签: c# amazon-web-services amazon-s3

列出S3文件时出现异常。

**"Operation is not valid due to the current state of the object."**

以下是我的代码:

do
{
    Console.Write(HashS3Objects.Count+"\t\t\r" );
    try
    {
        listResponse = client.ListObjects(listRequest);
        foreach (S3Object obj in listResponse.S3Objects)
        {
            try
            {
                HashS3Objects.Add(obj.Key, obj);
            }
            catch (Exception ex1)
            {
                Console.WriteLine(ex1.Message);
            }
        }
    }
    catch(Exception ex1) **// This catch block catches the exception**
    {
        Console.WriteLine(ex1.Message);
    }
    listRequest.Marker = listResponse.NextMarker;
} while (listResponse.IsTruncated);

行listResponse = client.ListObjects(listRequest);抛出异常。

0 个答案:

没有答案