From 6d5a7bd3a24d55d8d8758e5f4f1e53930d8822b8 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 3 Apr 2025 11:03:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=AA=8C=E8=AF=81https?= =?UTF-8?q?=20=E8=AF=81=E4=B9=A6=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Helper/OSSService.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 419369dea..5c51268eb 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -13,6 +13,7 @@ using Microsoft.Extensions.Options; using Minio; using Minio.DataModel.Args; using Newtonsoft.Json; +using System.Net; using System.Reactive.Linq; using System.Runtime.InteropServices; @@ -390,6 +391,8 @@ public class OSSService : IOSSService } else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO") { + ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true; + var minIOConfig = ObjectStoreServiceOptions.MinIO; var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}") From e56d1b9573e0f7b83ad4decc78033bfe2e6b5d96 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 3 Apr 2025 11:14:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8D=A2=E4=B8=80=E7=A7=8D=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E5=BF=BD=E7=95=A5=E8=AF=81=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Helper/OSSService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 5c51268eb..4fd0137f2 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -391,14 +391,20 @@ public class OSSService : IOSSService } else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO") { - ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => true; + + var httpClientHandler = new HttpClientHandler + { + ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator + }; var minIOConfig = ObjectStoreServiceOptions.MinIO; var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}") .WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey).WithSSL(minIOConfig.UseSSL) + .WithHttpClient(new HttpClient(httpClientHandler)) .Build(); + var getObjectArgs = new GetObjectArgs() .WithBucket(minIOConfig.BucketName) .WithObject(ossRelativePath) From 9f5aee9258d2879594a4dde48217765893343c67 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 3 Apr 2025 15:57:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9hir=20minio=20=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Helper/OSSService.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 4fd0137f2..0a888c09f 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -314,11 +314,18 @@ public class OSSService : IOSSService } else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO") { + + var httpClientHandler = new HttpClientHandler + { + ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator + }; + var minIOConfig = ObjectStoreServiceOptions.MinIO; var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}") .WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey).WithSSL(minIOConfig.UseSSL) + .WithHttpClient(new HttpClient(httpClientHandler)) .Build(); var putObjectArgs = new PutObjectArgs()