Reputation: 2469
I'm using Amazon .NET SDK, and adding file from my ASP.NET MVC app is working fine from my dev machine, when I`m deploying the app (on AppHarbor) I get the following error:
Could not establish trust relationship for the SSL/TLS secure channel.
Here is the code I`m using:
var config = new Amazon.S3.AmazonS3Config();
config.CommunicationProtocol = Amazon.S3.Model.Protocol.HTTPS;
using (var client = Amazon.AWSClientFactory.CreateAmazonS3Client("key", "secret", config))
{
var putRequest = new Amazon.S3.Model.PutObjectRequest();
putRequest.BucketName = "media.bunkerapp.com";
putRequest.CannedACL = Amazon.S3.Model.S3CannedACL.PublicRead;
putRequest.ContentType = file.ContentType;
putRequest.InputStream = file.InputStream;
putRequest.Key = "mykey";
Amazon.S3.Model.S3Response response = client.PutObject(putRequest);
response.Dispose();
}
I know that EU bucket cannot contains ., as seen on this question but I'm using a US Standard bucket. And again, the issue here is that it's not working on AppHarbor. I tried to roll-back to a 1 instance app, but it throw the same error, here is the stack trace:
at Amazon.S3.AmazonS3Client.ProcessRequestError(String actionName, HttpWebRequest request, WebException we, HttpWebResponse errorResponse, String requestAddr, WebHeaderCollection& respHdrs, Type t)
at Amazon.S3.AmazonS3Client.Invoke[T](S3Request userRequest)
at Amazon.S3.AmazonS3Client.PutObject(PutObjectRequest request)
at MyController...
Any pointer would be greatly appreciated.
Upvotes: 5
Views: 3346
Reputation: 3234
I can't reproduce this issue locally or on AppHarbor. I'm using similar code, bucket name (in US) and the newest AWS SDK.
I tried downgrading to version 1.3.4.1
and got an error similar to the one you describe ("The remote certificate is invalid according to the validation procedure").
Upgrading to the newest version of the AWS SDK for .NET (currently 1.4.3.0
) may be the solution.
Upvotes: 3