問題描述

若您有使用 .NET Core QRCoder 套件 或 相關繪圖套件,內部有使用 gdiplus 套件,部屬於 Linux Containerer 時有可能遇到下列問題:

Unable to load shared library 'gdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgdiplus: cannot open shared object file: No such file or directory...


解決方法

若部屬在 Azure App Service On Linux ,你可以在 App Service > 組態 > 執行命令,輸入


apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev && dotnet api.dll
view raw Start Command hosted with ❤ by GitHub



倘若不是透過 App Service,是透過其他 Container Service,您可以在 dockerfiles 內加入:
RUN apt-get update && apt-get install -y libgdiplus



FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS base
RUN apt-get update && apt-get install -y libgdiplus
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build
...


參考資料