首页 > 解决方案 > C# AWSSDK 调用 PutObjectAsync 返回 400 Bad Request InvalidArgument Unsupported Authoriaztion Type

问题描述

var config = new AmazonS3Config
                {
                    ServiceURL = url,
                    ForcePathStyle = true,
                };
var client = new AmazonS3Client(accesskeyId, accesskey, config);
var request = new PutObjectRequest
                {
                    BucketName = bucketName,
                    Key = $"ping_{Guid.NewGuid().ToString("N")}.txt",
                    ContentType = "text/plain",
}
                };
var response = await client.PutObjectAsync(request);

我收到错误:
StatusCode:400
ErrorCode:InvalidArgument
消息:不支持授权类型
Aws-sdk 版本:3.3.113.2

如果我使用 awssdk 3.1,没关系。有人知道吗?

标签: c#.netamazon-s3uploadaws-sdk

解决方案


推荐阅读