天天看點

.Net Core通過GDI+ 儲存圖檔在CentOS 7 Docker環境中報錯問題【已解決】

之前在netcore3.1環境中做了一個檔案上傳接口,用于存儲使用者頭像等檔案;在開發機器上(windows10)調試正常,但是部署到centos7容器docker環境中,發現前端調試請求500伺服器内部錯誤,The type initializer for ‘Gdip’ threw an exception

解決方法

首先進入容器,然後依次執行如下指令,等待指令執行完畢,重新開機容器即可解決’Gdip’報錯問題。

//更新元件包
apt-get update -y
//安裝libgdiplus
apt-get install -y libgdiplus
//清理緩存
apt-get clean
//建立連結
ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
           

繼續閱讀