首页 > Web开发 > 详细

.net Core 在 CentOS7下,报The type initializer for 'Gdip' threw an exception.异常

时间:2019-08-27 16:06:24      阅读:653      评论:0      收藏:0      [点我收藏+]

.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

 

.net Core 在 CentOS7下,报The type initializer for 'Gdip' threw an exception.异常

原文:https://www.cnblogs.com/CnKker/p/11418370.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!