.Net Core MVC 项目,添加了图片上传处理功能,使用了 System.Drawing.Common 引用。部署CentOS后,提示Unhandled Exception: System.TypeInitializationException: The type initializer for Gdip threw an exce...
.Net Core MVC 项目,添加了图片上传处理功能,使用了 System.Drawing.Common 引用。
部署CentOS后,提示
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
at Interop.Libdl.dlopen(String fileName, Int32 flag)
at System.Drawing.SafeNativeMethods.Gdip.LoadNativeLibrary()
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---
at System.Drawing.SafeNativeMethods.Gdip.GdipLoadImageFromDelegate_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr& image)
at System.Drawing.Image.InitFromStream(Stream stream)
at System.Drawing.Image.LoadFromStream(Stream stream, Boolean keepAlive)
at imagetest1.Program.Main(String[] args) in F:\imagetest1\imagetest1\Program.cs:line 13
C#
解决这个问题需要在CentOS中安装 libdl
#locate libdl
/usr/lib64/libdl-2.17.so
/usr/lib64/libdl.so.2
#cd /usr/lib64
#ln -s libdl-2.17.so libdl.so
?
然后又报另外一个错误:Unable to load DLL 'libgdiplus'
yum install libgdiplus-devel
转载:http://3624091.com/blogs/detail/21
沃梦达教程
本文标题为:.Net Core 使用 System.Drawing.Common 在CentOS下报错
基础教程推荐
猜你喜欢
- C# Winform实现石头剪刀布游戏 2023-01-11
- 京东联盟C#接口测试示例分享 2022-12-02
- C# – NetUseAdd来自Windows Server 2008和IIS7上的NetApi32.dll 2023-09-20
- 使用c#从分隔文本文件中插入SQL Server表中的批量数据 2023-11-24
- c#读取XML多级子节点 2022-11-05
- C#集合查询Linq在项目中使用详解 2023-06-09
- C#通过GET/POST方式发送Http请求 2023-04-28
- c#中利用Tu Share获取股票交易信息 2023-03-03
- Unity shader实现多光源漫反射以及阴影 2023-03-04
- C#中类与接口的区别讲解 2023-06-04
