admin管理员组文章数量:1387457
I'm using Amazon S3 AWSSDK.S3 For ASP.NET Core (version 3.7.415.17) to connect to Ionos S3 object storage.
I connect without problems and I'm able to get a pre-signed url, but I can't upload a file, I get always an error.
var s3Config = new AmazonS3Config { ServiceURL = "; };
_s3Client = new AmazonS3Client("**AccessKey***", "***SecretKey***", s3Config);
public async Task<string> UploadFileAsync(IFormFile file, string fileName, string? bucketName = null)
{
using var stream = file.OpenReadStream();
var request = new PutObjectRequest
{
BucketName = bucketName ?? _bucketName,
Key = fileName,
InputStream = stream,
ContentType = file.ContentType
};
var response = await _s3Client.PutObjectAsync(request);
return response.HttpStatusCode == System.Net.HttpStatusCode.OK ? fileName : null;
}
The error code I'm getting is "XAmzContentSHA256Mismatch". (Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.)
I have been reviewing a lot of tutorials and the code is very simple, but maybe there is something I'm missing.
UPDATE I have been trying previous versions just in case and...yes!!! Since version 3.7.412, it doesn't work, it throws the same error. The last version that works is the 3.7.411.7.
Maybe there is some info about this.
本文标签: ASPNET Amazon Storage Object S3 SDK on IonosStack Overflow
版权声明:本文标题:ASP.NET Amazon Storage Object S3 SDK on Ionos - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744571574a2613372.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论