Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e2d04808f | |||
| dc1f95c75e |
@@ -1206,14 +1206,21 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
|||||||
}
|
}
|
||||||
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();
|
||||||
|
|
||||||
|
|
||||||
var pipe = new System.IO.Pipelines.Pipe();
|
var pipe = new System.IO.Pipelines.Pipe();
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
@@ -1226,6 +1233,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
|||||||
.WithCallbackStream(stream =>
|
.WithCallbackStream(stream =>
|
||||||
{
|
{
|
||||||
stream.CopyTo(pipe.Writer.AsStream());
|
stream.CopyTo(pipe.Writer.AsStream());
|
||||||
|
pipe.Writer.FlushAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
await minioClient.GetObjectAsync(args);
|
await minioClient.GetObjectAsync(args);
|
||||||
@@ -1233,6 +1241,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Log.Error($"minio 获取流错误:{ex.Message}");
|
||||||
await pipe.Writer.CompleteAsync(ex);
|
await pipe.Writer.CompleteAsync(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user