zoukankan      html  css  js  c++  java
  • .net core3.1 文件导出报错The type initializer for 'Gdip' threw an exception 的解决方法

    .net Core允许在 Centos7 上,使用 System.Draw.Common类库时,报以下错误:

    复制代码
     "Class":"System.TypeInitializationException",
            "Message":"Unable to load DLL 'libgdiplus': The specified module could not be found.",
            "StackTrace":" at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromFile(String filename, IntPtr& bitmap)
    at System.Drawing.Bitmap..ctor(String filename, Boolean useIcm)
    at Ims.Dsl.Utility.ImageUtils.GetResolution(String filePath)
    at Ims.Dsl.Persistence.Service.Impl.TemplateService.CreateUploadImage(IList`1 files, String createIp)
    at Ims.Dsl.RestApi.Controllers.v1.TemplateController.UploadImage()
    复制代码

    解决方案如下:

    复制代码
    yum install autoconf automake libtool
    yum install freetype-devel fontconfig libXft-devel
    yum install libjpeg-turbo-devel libpng-devel giflib-devel libtiff-devel libexif-devel
    yum install glib2-devel cairo-devel
    git clone https://github.com/mono/libgdiplus
    cd libgdiplus
    ./autogen.sh
    make
    make install
    复制代码

    创建符号链接:

    ln -s /usr/local/lib/libgdiplus.so /usr/lib64/libgdiplus.so
    ln -s /usr/local/lib/libgdiplus.so /usr/libgdiplus.so

    方法亲测有效

    转载:https://www.cnblogs.com/CnKker/p/11418370.html

  • 相关阅读:
    帆软学习之开始
    「csp模拟」模拟测试11
    「csp模拟」模拟测试4
    「csp模拟」模拟测试3
    「csp模拟」模拟测试2
    「csp模拟」模拟测试1
    layui表格中日期格式的处理,从数字变日期格式
    Layui下拉框的事件和表格的刷新
    Layui的下拉框
    Layui按钮的禁用和恢复
  • 原文地址:https://www.cnblogs.com/axinno1/p/14867302.html
Copyright © 2011-2022 走看看