zoukankan      html  css  js  c++  java
  • 使用.Net MinIO SDK 踩的坑

    1、连接客户端时报错:MinIO API responded with message=No path allowed in endpoint 

    1
    2
    3
    4
    MinioClient minioClient = new MinioClient("http://XXXX:9000",
                                              accessKey:"Q3AM3UQ867SPQQA43P2F",
                                              secretKey:"zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
                                              ).WithSSL();

      

    解决方法:把url的前缀http://去掉即可

    2、报错MinIO API responded with message=Connection error: The SSL connection could not be established, see inner exception. The handshake failed due to an unexpected packet format.. Status code=0, response=The SSL connection could not be established, see inner exception. The handshake failed due to an unexpected packet format., content=)'

    没有搭https的话,把连接语句的 WithSSL() 去掉即可

    3、有个需求是从FTP服务里下载文件然后上传到MInIO,FTP使用了FluentFTP SDK,下载文件时直接new一个MempryStream来存储ftp文件的流,这样会导致上传到Minio的时候获取不到真正的文件size。

    1
    2
    3
    4
    var stream = new MemoryStream()
    await ftpClient.DownloadAsync(stream, item.FullName);
     
    await minioClient.PutObjectAsync("detection", item.Name, stream, stream.Length, "image/jpeg");

    所以只能先获取字节数据,再转换成流,我也搞不懂为什么,基础知识太差了。。有大神知道的话麻烦回复一下

    1
    2
    3
    4
    5
    var byts= await ftpClient.DownloadAsync(item.FullName,0)
    using (MemoryStream br = new MemoryStream(byts))//初始化MemoryStream,并将Buffer指向FileStream的读取结果数组
    {
       await minioClient.PutObjectAsync("detection", item.Name, br, br.Length, "image/jpeg");
    }

     

    之后成功上传到Minio

  • 相关阅读:
    xfs(dm-3):please umount the filesystem and rectify the problem(s)
    解决 pcre-8.35 make[2]: *** [aclocal.m4] Error 127
    redis-4.0.6 编译安装
    nginx出错:rewrite or internal redirection cycle
    17个技巧
    go-fastdfs/go-fastdfs-web
    Win X86 时间同步
    关闭或启动linux防火墙后,docker启动容器报错问题解决方式
    Nginx 重定向 443
    Docker 容器和宿主机相互拷贝文件
  • 原文地址:https://www.cnblogs.com/chinasoft/p/15304497.html
Copyright © 2011-2022 走看看