首页 新闻 会员 周边

.NET Core项目在Linux上使用QRCoder时出错"Unable to load DLL 'gdiplus'"

2
悬赏园豆:20 [已解决问题] 解决于 2017-10-05 21:49

QRCoder 是一个支持 .NET Core 的用于生成二维码的开源库,在一个 .NET Core 项目中使用时,在 Windows 上可以正常生成二维码,发布到Linux Ubuntu服务器上运行时出现下面的错误:

System.TypeInitializationException: The type initializer for 'System.DrawingCore.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
   at System.DrawingCore.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input, GdiplusStartupOutput& output)
   at System.DrawingCore.GDIPlus..cctor()
   --- End of inner exception stack trace ---
   at System.DrawingCore.GDIPlus.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, PixelFormat format, IntPtr scan0, IntPtr& bmp)
   at System.DrawingCore.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   at QRCoder.QRCode.GetGraphic(Int32 pixelsPerModule, Color darkColor, Color lightColor, Boolean drawQuietZones)
   at QRCoder.Base64QRCode.GetGraphic(Int32 pixelsPerModule)

请问如何解决这个问题?

dudu的主页 dudu | 高人七级 | 园豆:30966
提问于:2017-10-05 21:02
< >
分享
最佳答案
2

1) apt install libgdiplus 

2) cp /usr/lib/libgdiplus.so ~/.nuget/packages/qrcoder/1.3.1/lib/netstandard2.0 

dudu | 高人七级 |园豆:30966 | 2017-10-05 21:49

试过了,好使,感谢楼主

唐伯虎点炮仗 | 园豆:200 (初学一级) | 2019-07-04 15:58
其他回答(3)
1

Centos 7

yum install libgdiplus-devel

hobinly | 园豆:202 (菜鸟二级) | 2017-10-31 16:29
0

OKKKkkkkk

weisp | 园豆:3 (初学一级) | 2018-06-22 23:03
0

非常感谢 !!! 刚好core 项目迁移 linux centos 碰到类似问题,我是 NPOI excel导出 碰到

小贝007 | 园豆:202 (菜鸟二级) | 2020-06-22 17:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册