今天在CentOS 7 上运行 .Net Core 2.2 Web API 项目 使用 QRCoder 创建二维码的时候发生以下错误
// 文章来源 http://blog.csdn.net/jasonsong2008
An unhandled exception occurred while processing the request.
DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found.
System.Runtime.InteropServices.FunctionWrapper<T>.get_Delegate()
TypeInitializationException: The type initializer for 'Gdip' threw an exception.
System.Drawing.SafeNativeMethods+Gdip.GdipCreateBitmapFromScan0(int width, int height, int stride, PixelFormat format, IntPtr scan0, out IntPtr bmp)
解决办法如下:
CentOS 系统请执行以下命令
[root@JasonSong /]# sudo yum install libgdiplus-devel
UBuntu 系统请执行以下命令
sudo apt-get install libgdiplus