为什么我无法加载DLL'libgdiplus':找不到指定的模块-CentOS 7.5

时间:2019-05-24 07:39:20

标签: c#

下面的代码在本地开发机中可以正常工作。(Windows 8.1 x64)

   [HttpGet]
   [AllowAnonymous]
     public ActionResult TestReport(int _pid)
    {
        Reports.XtraReport _xtrareport = new Reports.XtraReport();
        _xtrareport.CreateDocument(true);
        var stream = new MemoryStream();
        _xtrareport.ExportToPdf(stream);
        return  File(stream.GetBuffer(), "application/pdf");
      }

但是当我尝试使用CentOS 7.5时,它在下面抛出了异常

,它在下面引发了异常:

  

处理以下内容时发生未处理的异常   request.DllNotFoundException:无法加载DLL“ libgdiplus”:   找不到指定的模块。   System.Runtime.InteropServices.FunctionWrapper.get_Delegate()

     

TypeInitializationException:“ Gdip”的类型初始值设定项引发了   例外。   System.Drawing.SafeNativeMethods + Gdip.GdipGetGenericFontFamilySansSerif(out   IntPtr fontfamily)

     

TypeInitializationException:类型初始值设定项   'DevExpress.XtraPrinting.BrickStyle'引发了异常。   DevExpress.XtraReports.UI.XRControlStyle..ctor()

     

堆栈查询Cookie标头DllNotFoundException:无法加载   DLL'libgdiplus':指定的模块不能为   找到.System.Runtime.InteropServices.FunctionWrapper.get_Delegate()   System.Drawing.SafeNativeMethods + Gdip.GdiplusStartup(out IntPtr令牌,   ref StartupInput输入,out StartupOutput输出)   System.Drawing.SafeNativeMethods + Gdip..cctor()

     

显示原始异常详细信息

     

TypeInitializationException:“ Gdip”的类型初始值设定项引发了   exception.System.Drawing.SafeNativeMethods + Gdip.GdipGetGenericFontFamilySansSerif(out   IntPtr fontfamily)System.Drawing.FontFamily.GetGdipGenericSansSerif()   System.Drawing.FontFamily.get_GenericSansSerif()   System.Drawing.Font.CreateFont(字符串familyName,float emSize,   FontStyle样式,GraphicsUnit单位,字节charSet,bool isVertical)   DevExpress.XtraPrinting.BrickStyle..cctor()

1 个答案:

答案 0 :(得分:0)

我已通过以下步骤解决了这个问题:

    sudo yum install yum-utils
    sudo rpm rpm --import    "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
    sudo yum-config-manager --add-repo http://download.mono-  project.com/repo/centos/
    sudo yum clean all
    sudo yum makecache
    sudo yum install mono-complete