换一种方式忽略证书
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-04-03 11:14:06 +08:00
parent 6d5a7bd3a2
commit e56d1b9573
1 changed files with 7 additions and 1 deletions

View File

@ -391,14 +391,20 @@ public class OSSService : IOSSService
} }
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO") else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{ {
ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true;
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
var minIOConfig = ObjectStoreServiceOptions.MinIO; var minIOConfig = ObjectStoreServiceOptions.MinIO;
var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}") var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}")
.WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey).WithSSL(minIOConfig.UseSSL) .WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey).WithSSL(minIOConfig.UseSSL)
.WithHttpClient(new HttpClient(httpClientHandler))
.Build(); .Build();
var getObjectArgs = new GetObjectArgs() var getObjectArgs = new GetObjectArgs()
.WithBucket(minIOConfig.BucketName) .WithBucket(minIOConfig.BucketName)
.WithObject(ossRelativePath) .WithObject(ossRelativePath)