.NET Core----Docker The type initializer for 'Gdip' threw an exception异常

ASP.NET Core项目部署在Linux容器中会出现GDI错误 因为在项目中使用了生成验证码导致

解决方案:

RUN echo "deb http://mirrors.163.com/debian/ stretch main non-free contrib" > /etc/apt/sources.list && \
echo "deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list && \
echo "deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.163.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list && \
echo "deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib" >> /etc/apt/sources.list && \
echo "deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install libgdiplus libc6-dev -y && \
ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll && \
ln -s /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib/libdl.dll
在dockerfile添加上述文件 
.NET Core----Docker The type initializer for 'Gdip' threw an exception异常_第1张图片

你可能感兴趣的:(linux,debian,docker,c#,apt)