docker容器运行.net core3.0的坑一:无法执行image类(亲测原创技术分享)
转载:http://www.freetechs.cn/archives/70
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
在容器里顺序执行命令
apt-get update apt-get install libgdiplus