我正在使用Amazon AWS .NET SDK v1.2.1。Amazon S3问题获得SSL与c#sdk配合使用
下面的代码未能通过DNS查找myBucket.more.https
这显然不是后抛出一个异常,它应该寻找...
AmazonS3Config S3Config = new AmazonS3Config()
{
ServiceURL = "https://s3.amazonaws.com",
CommunicationProtocol = Amazon.S3.Model.Protocol.HTTPS,
};
using (AmazonS3 client = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey,secretKey, S3Config))
{
PutObjectRequest request = new PutObjectRequest();
using (MemoryStream ms = new MemoryStream(inputBytes))
{
request.WithBucketName("myBucket.more")
.WithKey(output.Name)
.WithInputStream(ms);
using (S3Response response = client.PutObject(request))
{
Log.Message("File Sent: " + output.Name);
}
}
}
如果我从它抛出的serviceUrl的前部取出https://
与Web异常:
"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
所以我怎样想获得SSL工作?
到目前为止,我所管理的唯一方法是使用下面的,这是不可靠:
AmazonS3Config S3Config = new AmazonS3Config()
{
ServiceURL = "s3.amazonaws.com",
CommunicationProtocol = Amazon.S3.Model.Protocol.HTTP,
};
UPDATE
如果我不通过自定义S3Config到CreateAmazonS3Client
,它
"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
"The remote certificate is invalid according to the validation procedure."
:仍在与失败
该存储桶是在几个小时前创建的,如果关闭SSL,它可以完美工作。使用默认配置,我得到:“底层连接已关闭:无法建立SSL/TLS安全通道的信任关系。根据验证过程,远程证书无效。” – Tim 2011-01-27 16:00:42