Amazon S3 Error - Failed to establish trust for SSL / TLS secure channel

I am using the Amazon.NET SDK and adding a file from my ASP.NET MVC application works fine from my dev machine when I deploy the application (on AppHarbor ) I get the following error:

Failed to establish trust for 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 the EU bucket cannot contain., As can be seen on this , but I use the US Standard bucket. And again, the problem here is that it is not working on AppHarbor. I tried to return to 1 instance of the application, but it gives 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 is appreciated.

+4
source share
1 answer

I cannot reproduce this problem locally or on AppHarbor. I use the same code, bucket name (in the USA) and the latest AWS SDK.

I tried downgrading to version 1.3.4.1 and received an error similar to the one you are describing ("The remote certificate is not valid according to the verification procedure").

Upgrading to the latest version of the AWS SDK for .NET (currently 1.4.3.0 ) may be a solution.

+3
source

Source: https://habr.com/ru/post/1397677/


All Articles