AmazonS3.AmazonS3Exception: AuthMethodNotRecognized

0

I am developing a web API in .NET6. I have this problem, "AmazonS3.AmazonS3Exception: AuthMethodNotRecognized", when I try to use a method of the IAmazonS3 interface (ex. ListBucketAsync, CreateBucketAsync etc.). How can I fix it? I use the AWSSDK.S3 3.7.8.26 in my project. Thanks in advance

  • Please provide a snippet of you code demonstrating how you create an instance of the S3 client object. Also, please elaborate in which environment you call the API (from a Lambda function? from a container? from your local machine?) How do you provide credentials to the API calls?

  • Hi Dimitry , i'm using AWSSDK.S3 "Version =" 3.7.8.26" and I would like to communicate with an external storage to amazon (S3 compatible)

    public AppConfiguration() { _awsAccessKey = appSetting["AwsAccessKey"]; _awsSecretAccessKey = appSetting["AwsSecretAccessKey"]; _restEndPoint = appSetting["RestEndPoint"]; _as3Config = new AmazonS3Config { ServiceURL = _restEndPoint }; _basicAwsCredentials = new BasicAWSCredentials(_awsAccessKey, _awsSecretAccessKey); }

    public ObjectStorage(IAppConfiguration appConfiguration) { _aws3Services = new S3ApiGateway(appConfiguration.BasicCredentials,appConfiguration.As3Config);

        }
    

    public List<string> GetBucketsList() { return _aws3Services.GetBucketsListAsync().Result; }

    public async Task<List<string>> GetBucketsListAsync() { try { var getPutBucketResponse= await GetBucketsList(); return getPutBucketResponse.Buckets.Select(s=> s.BucketName).ToList(); } catch (Exception e) { throw e; } }

      private async Task<ListBucketsResponse> GetBucketsList() 
        {
            return await _awsS3Client.ListBucketsAsync();   //In this point throw exceptione 
        }
    
gefragt vor 2 Jahren66 Aufrufe
Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen