zoukankan      html  css  js  c++  java
  • .Net Core 使用 System.Drawing.Common 在CentOS下报错

    .Net Core MVC 项目,添加了图片上传处理功能,使用了 System.Drawing.Common 引用。

    部署CentOS后,提示

    Unhandled Exception: System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
       at Interop.Libdl.dlopen(String fileName, Int32 flag)
       at System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary()
       at System.Drawing.SafeNativeMethods.Gdip..cctor()
       --- End of inner exception stack trace ---
       at System.Drawing.SafeNativeMethods.Gdip.GdipLoadImageFromDelegate_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr& image)
       at System.Drawing.Image.InitFromStream(Stream stream)
       at System.Drawing.Image.LoadFromStream(Stream stream, Boolean keepAlive)
       at imagetest1.Program.Main(String[] args) in F:imagetest1imagetest1Program.cs:line 13
    C#

    解决这个问题需要在CentOS中安装 libdl

    #locate libdl
    /usr/lib64/libdl-2.17.so
    /usr/lib64/libdl.so.2
    #cd /usr/lib64
    #ln -s libdl-2.17.so libdl.so
     

    然后又报另外一个错误:Unable to load DLL 'libgdiplus'

    yum install libgdiplus-devel

    转载:http://3624091.com/blogs/detail/21
  • 相关阅读:
    寒假短期学习计划
    PAT 1001 A+B 解题报告
    JavaScript 原型链、继承
    JavaScript 数据扁平化处理
    每周一篇React: 高阶 hoc_component 使用
    每天一道算法题: day1 翻转图像
    项目中下载加权,你是怎么做的,欢迎评论。
    前端封装验证码方法,封装验证码类
    文件下载之后默认不打开实现方式
    文件下载之后默认不打开实现方式
  • 原文地址:https://www.cnblogs.com/yuany69/p/14385703.html
Copyright © 2011-2022 走看看