Epplus于linux环境下无预设lib的报错与解决
Epplus为.NET众所皆知的Excel读取与写入函式库
在利用此函式库撰写相关功能报表并于Windows环境下测试与呈现结果皆是正常的.
然而把sevice app于linux docker的容器环境下run在此功能会丢出:
the type initializer for 'gdip' threw an exception.
原因:
经查询的错误原因为.NET的System.Drawing.dll内部依赖了 gdiplus.dll ,
而gdiplus.dll在Windows的环境上操作系统会自带此dll,而在Mac和linux系统是没有相关预设只能自己去添加
解决:
于app所在的docker内更新并安装此lib再重启该功能的app便可以正常运作
1.进入到docker
2.RUN apt-get update && apt-get install -y libgdiplus
3.重启app
source:
Unable to load shared library “libgdiplus” - Docker [ .NET application with Aspose API]
【asp.net core】macOS Gdip 报错