信任证书
continuous-integration/drone/push Build is running Details

Test_HIR_Net8
hang 2026-06-05 14:16:07 +08:00
parent 5a27fbc127
commit c72f50c1f7
1 changed files with 36 additions and 29 deletions

View File

@ -527,40 +527,47 @@ 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() 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();
#region 废弃3 #region 废弃3
//var pipe = new System.IO.Pipelines.Pipe(); var pipe = new System.IO.Pipelines.Pipe();
//_ = Task.Run(async () => _ = Task.Run(async () =>
//{ {
// try try
// { {
// var args = new GetObjectArgs() var args = new GetObjectArgs()
// .WithBucket(minIOConfig.BucketName) .WithBucket(minIOConfig.BucketName)
// .WithObject(ossRelativePath) .WithObject(ossRelativePath)
// .WithCallbackStream(async source => .WithCallbackStream(async source =>
// { {
// await source.CopyToAsync(pipe.Writer.AsStream()); await source.CopyToAsync(pipe.Writer.AsStream());
// await pipe.Writer.FlushAsync(); await pipe.Writer.FlushAsync();
// }); });
// await minioClient.GetObjectAsync(args); await minioClient.GetObjectAsync(args);
// } }
// finally finally
// { {
// await pipe.Writer.CompleteAsync(); await pipe.Writer.CompleteAsync();
// } }
//}); });
//return pipe.Reader.AsStream(); return pipe.Reader.AsStream();
#endregion #endregion
@ -599,16 +606,16 @@ public class OSSService : IOSSService
#region 废弃 #region 废弃
var memoryStream = new MemoryStream(); //var memoryStream = new MemoryStream();
var getObjectArgs = new GetObjectArgs() //var getObjectArgs = new GetObjectArgs()
.WithBucket(minIOConfig.BucketName) // .WithBucket(minIOConfig.BucketName)
.WithObject(ossRelativePath) // .WithObject(ossRelativePath)
.WithCallbackStream(stream => stream.CopyToAsync(memoryStream)); // .WithCallbackStream(stream => stream.CopyToAsync(memoryStream));
await minioClient.GetObjectAsync(getObjectArgs); //await minioClient.GetObjectAsync(getObjectArgs);
memoryStream.Position = 0; //memoryStream.Position = 0;
return memoryStream; //return memoryStream;
#endregion #endregion