欢迎光临
我们一直在努力

docker容器运行.net core3.0的坑一:无法执行image类(亲测原创技术分享)

docker容器运行.net core3.0的坑一:无法执行image类

当.net core 3.0项目上用到image类时,会遇到如下问题

System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
   at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
   at System.Drawing.SafeNativeMethods.Gdip..cctor()
   --- End of inner exception stack trace ---
   at SmallWeb.Areas.OCR.Controllers.HomeController.Base64StrToImage(String base64Str) in C:\Users\sjn\source\repos\SmallWeb\SmallWeb\Areas\OCR\Controllers\HomeController.cs:line 256
   at SmallWeb.Areas.OCR.Controllers.HomeController.upload() in C:\Users\sjn\source\repos\SmallWeb\SmallWeb\Areas\OCR\Controllers\HomeController.cs:line 65

我是先用下面的命令进入容器中

docker exec -it 90b2ed24a5e6 /bin/bash

然后在容器里顺序执行命令

apt-get update
apt-get install libgdiplus

等安装结束后用exit 退出docker 容器,然后重启当前容器。问题解决

 

赞(1)
未经允许不得转载:自游互动 » docker容器运行.net core3.0的坑一:无法执行image类(亲测原创技术分享)
分享到: 更多 (0)

自由技术,自由自在

项目合作联系我们