1
 var client = new AmazonS3Client(Amazon.RegionEndpoint.USEast2);

        try
        {
            PutObjectRequest putRequest = new PutObjectRequest
            {
                BucketName = bucketName,
                Key = keyName,
                ContentBody = filePath,
                ContentType = "text/plain"
            };

            PutObjectResponse response = client.PutObject(putRequest);
        }

I want to upload a file to s3 bucket using this code this is the error i am getting.

Error   CS0122  'AmazonS3Client.PutObject(PutObjectRequest)' is inaccessible due to its protection level    
1
  • You haven't added your code into public class ,can you post your complete code for more clarity ? Commented Mar 21, 2018 at 6:43

1 Answer 1

2

I'm guessing this is .NET Core. In .NET Core only the async versions are public to match what the underlying HttpClient supports in .NET Standard 1.3 which is what the AWS SDK targets for .NET Core based projects. In your case you would need to call client.PutObjectAsync.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.