这是我的代码:

try
{
TransferUtility fileTransferUtility = new
                    TransferUtility(new AmazonS3Client(Amazon.RegionEndpoint.USEast1));

TransferUtilityUploadRequest fileTransferUtilityRequest = new TransferUtilityUploadRequest
                  {
                      BucketName = bucketName,
                      FilePath = filePath,
                      StorageClass = S3StorageClass.ReducedRedundancy,
                      PartSize = 6291456, // 6 MB.
                      Key = keyName,
                      CannedACL = S3CannedACL.PublicRead
                  };

                fileTransferUtility.Upload(fileTransferUtilityRequest);

 }
catch (AmazonS3Exception s3Exception)
{
 Console.WriteLine(s3Exception.Message,
                                  s3Exception.InnerException);
}
catch (Exception ex)
{

}


无论我执行什么代码,都会得到异常
“无法从程序集'mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'加载类型'System.Runtime.ExceptionServices.ExceptionDispatchInfo'。”

任何帮助将不胜感激 。

最佳答案

AWS开发工具包将仅在.NET 4.5或3.5上运行,而您当前拥有的是4.0。

安装/更改为.NET 4.5应该可以解决您的问题。

来源(AWS SDK页面):https://aws.amazon.com/sdk-for-net/

07-24 09:22