docker 或linux 中使用 图片类
docker 或linux 中使用 图片类
异常报错
The type initializer for 'Gdip' threw an exception. 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
一. 引用ZKWeb.System.Drawing
Install-Package ZKWeb.System.Drawing
二. 页面上引用using System.DrawingCore
将原来的
using System.Drawing;
using System.Drawing.Imaging;
改为ZKWeb的
using System.DrawingCore;
using System.DrawingCore.Imaging;
三. 修改DockerFile
- 加入安装命令
RUN apt-get update -y && apt-get install -y libgdiplus && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
- 或直接用 stulzq/dotnet:2.2.0-aspnetcore-runtime-with-image 做为底包
将
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
改为
FROM stulzq/dotnet:2.2.0-aspnetcore-runtime-with-image AS base
源码地址:https://github.com/langfengac/Demo/tree/master/ImagesIssue