From 1175696590cff986af75d62e8971e65d394b279f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 10 Jan 2024 13:37:16 +0800 Subject: [PATCH] =?UTF-8?q?minio=20=E6=B5=8B=E8=AF=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Test_IRC.json | 2 +- IRaCIS.Core.Application/TestService.cs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.API/appsettings.Test_IRC.json b/IRaCIS.Core.API/appsettings.Test_IRC.json index edad727d5..2ab92a091 100644 --- a/IRaCIS.Core.API/appsettings.Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.Test_IRC.json @@ -28,7 +28,7 @@ }, "MinIO": { - "endpoint": "http://192.168.3.68", + "endpoint": "192.168.3.68", "port": "8001", "useSSL": false, "accessKey": "IDFkwEpWej0b4DtiuThL", diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 424bceafb..156f0d6b2 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -17,11 +17,14 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using MiniExcelLibs; using Minio; +using Minio.DataModel.Args; using NPOI.HPSF; using NPOI.POIFS.Crypt; +using SharpCompress.Common; using Spire.Doc; using System.Linq.Expressions; using System.Reflection.Metadata; +using System.Security.AccessControl; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; @@ -166,12 +169,16 @@ namespace IRaCIS.Application.Services var minioClient = new MinioClient().WithEndpoint($"{minIO.endpoint}:{minIO.port}") - .WithCredentials(minIO.accessKey, minIO.secretKey) + .WithCredentials(minIO.accessKey, minIO.secretKey).WithSSL(false) .Build(); + var putObjectArgs = new PutObjectArgs() + .WithBucket(minIO.bucketName) + .WithObject("myfolder/test.txt") + .WithFileName("C:\\Users\\Administrator\\Desktop\\TrialSiteUserImportTemplate.xlsx"); + await minioClient.PutObjectAsync(putObjectArgs); - //ResponseOutput.Ok(options) return await Task.FromResult(ResponseOutput.Ok(options)); }