修改minio 下载测试

Test_HIR_Net8
hang 2025-09-02 18:08:25 +08:00
parent 2f69df7a83
commit b359508ab4
1 changed files with 45 additions and 0 deletions

View File

@ -16,6 +16,7 @@ using Minio;
using Minio.DataModel; using Minio.DataModel;
using Minio.DataModel.Args; using Minio.DataModel.Args;
using Minio.Exceptions; using Minio.Exceptions;
using System.Net.Http;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Web; using System.Web;
@ -226,8 +227,14 @@ public class OSSService : IOSSService
var minIOConfig = ObjectStoreServiceOptions.MinIO; var minIOConfig = ObjectStoreServiceOptions.MinIO;
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
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 putObjectArgs = new PutObjectArgs() var putObjectArgs = new PutObjectArgs()
@ -347,9 +354,14 @@ public class OSSService : IOSSService
{ {
var minIOConfig = ObjectStoreServiceOptions.MinIO; var minIOConfig = ObjectStoreServiceOptions.MinIO;
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
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 putObjectArgs = new PutObjectArgs() var putObjectArgs = new PutObjectArgs()
@ -420,10 +432,16 @@ public class OSSService : IOSSService
} }
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO") else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{ {
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()
@ -508,10 +526,17 @@ public class OSSService : IOSSService
{ {
var minIOConfig = ObjectStoreServiceOptions.MinIO; var minIOConfig = ObjectStoreServiceOptions.MinIO;
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
var minioClient = new MinioClient() var minioClient = new MinioClient()
.WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}") .WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}")
.WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey) .WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey)
.WithSSL(minIOConfig.UseSSL) .WithSSL(minIOConfig.UseSSL)
.WithHttpClient(new HttpClient(httpClientHandler))
.Build(); .Build();
var memoryStream = new MemoryStream(); var memoryStream = new MemoryStream();
@ -961,8 +986,14 @@ public class OSSService : IOSSService
var minIOConfig = ObjectStoreServiceOptions.MinIO; var minIOConfig = ObjectStoreServiceOptions.MinIO;
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
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();
@ -1070,8 +1101,15 @@ public class OSSService : IOSSService
var minIOConfig = ObjectStoreServiceOptions.MinIO; var minIOConfig = ObjectStoreServiceOptions.MinIO;
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
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();
@ -1149,8 +1187,15 @@ public class OSSService : IOSSService
var minIOConfig = ObjectStoreServiceOptions.MinIO; var minIOConfig = ObjectStoreServiceOptions.MinIO;
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
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();