minio / minio-dotnet

MinIO Client SDK for .NET
https://docs.min.io/docs/dotnet-client-quickstart-guide.html
Apache License 2.0
577 stars 230 forks source link

Asp net core api - Access Key problem #885

Open jigrain opened 1 year ago

jigrain commented 1 year ago

I am trying to add MinIo to asp net core. In a regular non web application, I use the following code to create a MinioClient instance and perform operations:

                MinioClient minio = new MinioClient()
                                    .WithEndpoint(endpoint)
                                    .WithCredentials(accessKey, secretKey)
                                    .WithSSL(secure)
                                    .Build();

But when I try to connect it to the asp net core api using the code sample I saw on the main page of this repository, I get an error: The Access Key Id you provided does not exist in our records.

Has anyone faced such problems?

builder.Services.AddMinio(configureClient => configureClient
    .WithEndpoint(endpoint)
    .WithCredentials(accessKey, secretKey));
yermakovsergey commented 1 year ago

Try find config property of your MinioClient in debug mode and check it. Maybe I have similar problem, but I'm not sure https://github.com/minio/minio-dotnet/issues/887

S3V3N-11 commented 1 year ago

Try this, the BaseUrl will be ok.

builder.Services.AddMinio(configureClient => configureClient .WithEndpoint(endpoint) .WithCredentials(accessKey, secretKey) .Build() );

jigrain commented 1 year ago

Try this, the BaseUrl will be ok.

builder.Services.AddMinio(configureClient => configureClient .WithEndpoint(endpoint) .WithCredentials(accessKey, secretKey) .Build() );

Now I get an error: Connection error:The SSL connection could not be established, see inner exception.... Status code=0, response=The SSL connection could not be established, see inner exception. I don't use SSL for my MinIO and accordingly I write ".WithSSL(false)" but as far as I understand it doesn't work for Asp net core format.