0

我正在尝试在 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"]
4

0 回答 0