Mainak
Mainak

Reputation: 470

Unable to ulpoad file using S3 TransferutilityUploadRequest

Here is my code :

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)
{

}

Wherenever I execute this code I get the exception "Could not load type 'System.Runtime.ExceptionServices.ExceptionDispatchInfo' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'."

Any help will be appreciated .

Upvotes: 2

Views: 1647

Answers (1)

James Joyce Alano
James Joyce Alano

Reputation: 703

AWS SDK will run only on .NET 4.5 or 3.5, and what you currently have is 4.0.

Installing/Changing to .NET 4.5 should solve your problem.

Source (AWS SDK page): https://aws.amazon.com/sdk-for-net/

Upvotes: 1

Related Questions