在 Windows Container Docker 上运行时无法加载 libwkhtmltox DLL

问题描述

我正在尝试在 Docker 的 Windows 容器中运行我的项目,但是在加载 DinkToPDF 所需的 dll 时我一直遇到这种错误

System.DllNotFoundException: '无法加载 DLL 'C:\app\libwkhtmltox' 或其依赖项之一:找不到指定的模块。 (0x8007007E)'

已经在此线程上尝试了建议的解决方案,但仍然没有运气:

https://github.com/rdvojmoc/DinkToPdf/issues/116

https://github.com/rdvojmoc/DinkToPdf/issues/5

下面是我当前的 Dockerfile

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

#Depending on the operating system of the host machines(s) that will build or run the containers,the image specified in the FROM statement may need to be changed.
#For more information,please see https://aka.ms/containercompat
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
workdir /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
workdir /src
copY ["{ProjectName}/{ProjectName}.csproj","{ProjectName}/"]
RUN dotnet restore "{ProjectName}/{ProjectName}.csproj"
copY . .
workdir "/src/{ProjectName}"
RUN dotnet build "{ProjectName}.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "{ProjectName}.csproj" -c Release -o /app/publish

FROM base AS final
workdir /app
copY --from=publish /app/publish .
ENTRYPOINT ["dotnet","{ProjectName}.dll"]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)