我正在使用一个容器化的ASP.Net Core(2.1)应用程序。容器正在运行Debian Stretch。除了这一个小细节,其他所有东西都工作正常-每当我想使用Rotativa时,我都会收到以下消息:
Unable to find view '/app/wwwroot/templates/IssuedInvoice.cshtml'. The following locations were searched:\n/app/wwwroot/templates/IssuedInvoice.cshtml
这很可能意味着该文件不存在。公平地说,我进入docker容器并发出cat /app/wwwroot/templates/IssuedInvoice.cshtml
,我会发现什么?文件已列出,没有任何错误。
有人遇到过这样的问题吗?我认为这不是权限问题,因为该应用无论如何都以root用户身份在容器内运行。
我已经在容器外部对此进行了测试,并且一切工作正常,在Debug和Release配置上也是如此。
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["JTEPanel.Api/JTEPanel.Api.csproj", "JTEPanel.Api/"]
COPY ["JTEPanel.Infrastructure/JTEPanel.Infrastructure.csproj", "JTEPanel.Infrastructure/"]
COPY ["JTEPanel.SmsApi/JTEPanel.SmsApi.csproj", "JTEPanel.SmsApi/"]
COPY ["JTEPanel.Domain/JTEPanel.Domain.csproj", "JTEPanel.Domain/"]
COPY ["JTEPanel.Common/JTEPanel.Common.csproj", "JTEPanel.Common/"]
RUN dotnet restore "JTEPanel.Api/JTEPanel.Api.csproj"
COPY . .
WORKDIR "/src/JTEPanel.Api"
RUN dotnet build "JTEPanel.Api.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "JTEPanel.Api.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
VOLUME /app/wwwroot
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales libgdiplus wkhtmltopdf
RUN ln -s /usr/bin/wkhtmltopdf /app/wwwroot/Rotativa/wkhtmltopdf
RUN sed -i -e 's/# pl_PL.UTF-8 UTF-8/pl_PL.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=pl_PL.UTF-8
ENV LANG pl_PL.UTF-8
ENTRYPOINT ["dotnet", "JTEPanel.Api.dll"]