0

尝试使用 .NET sdk 将文件上传到 Amazon Glacier 时,我不断收到以下异常:

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Amazon.Glacier.Model.Internal.MarshallTransformations.UploadArchiveResponseUnmarshaller.UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
   at Amazon.Runtime.Internal.Transform.JsonResponseUnmarshaller.UnmarshallException(UnmarshallerContext input, Exception innerException, HttpStatusCode statusCode)
   at Amazon.Runtime.AmazonWebServiceClient.handleHttpWebErrorResponse(AsyncResult asyncResult, WebException we)
   at Amazon.Runtime.AmazonWebServiceClient.getResponseCallback(IAsyncResult result)
   at Amazon.Runtime.AmazonWebServiceClient.endOperation[T](IAsyncResult result)
   at Amazon.Glacier.Transfer.Internal.SinglepartUploadCommand.Execute()
   at Amazon.Glacier.Transfer.ArchiveTransferManager.Upload(String vaultName, String archiveDescription, String filepath, UploadOptions options)
   at UClaim.TaskRunner.Tasks.ArchiveDocuments.Execute() in c:\Projects\uclaim\src\UClaim.TaskRunner\Tasks\ArchiveDocuments.cs:line 55

我不知道为什么会发生这种情况或这意味着什么,而谷歌搜索却一无所获。我使用的代码没什么特别的,但这里是为了完整性。

var document = GetDocumentToArchive();
var manager = new ArchiveTransferManager(Amazon.RegionEndpoint.EUWest1);
document.ArchiveId = manager.Upload(
    "archivedDocs",
    string.Format("#{0}: {1}", document.Claim.Id, document.Description),
    document.GeneratePathOnServer()).ArchiveId;
4

1 回答 1

0

好吧,事实证明这是一个愚蠢的错误。我认为如果它不存在,SDK 会创建它,但我猜它试图查找它并失败。我登录到管理控制台并创建了“archivedDocs”保管库,现在它运行良好

于 2013-11-05T17:10:26.863 回答