Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
AWSSDK S3 for ASP.NET Core

I have tried to upload file to Amazon S3 using AWSSDK for .NET Core, but I always got exception like below:

The write operation failed, see inner exception.

The connection with the server was terminated abnormally

No matter connect to Singapore (Global) or Beijing (cn-north-1), it still has problem.

Can anyone give me some suggestions to solve this problem?

This is version and codes, please!

.NET Core / 1.1.1
AWSSDK.S3 / 3.3.5.10

Startup.cs

// Add framework services.
services.AddMvc();
services.AddDefaultAWSOptions(Configuration.GetAWSOptions());
services.AddAWSService<IAmazonS3>();

appsettings.json

"AWS_ACCESS_KEY_ID": "xxxxxxxxxx",
"AWS_SECRET_ACCESS_KEY": "xxxxxxxxxxxxxxxxxxxxxxxx",
"AWS": {
  "Region": "cn-north-1",
  "ServiceURL": "https://s3.cn-north-1.amazonaws.com.cn"
}

Controller

private readonly IAmazonS3 _AmazonS3Client;

public UsersController(
       IAmazonS3 AmazonS3Client)
{
     _AmazonS3Client = AmazonS3Client;
}


[HttpPost]
[Route("users/picture/upload")]
public async Task<IActionResult> UploadUserPhoto(string UserId)
{
    Amazon.S3.Model.PutObjectResponse response = await 
       _AmazonS3Client.PutObjectAsync(
       new Amazon.S3.Model.PutObjectRequest()
       {
           BucketName = "mybucket",
           Key = fileName,
           InputStream = uploadFiles[0].OpenReadStream(),
           CannedACL = S3CannedACL.PublicRead
       });
}
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!