gpt4 book ai didi

docker - 未找到 asp.net 核心 docker linux 程序集

转载 作者:行者123 更新时间:2023-12-02 18:36:06 24 4
gpt4 key购买 nike

在 linux 上将 asp.net core 2.2 应用程序部署到 docker 时,运行 dotnet someprogram.dll 时,它提示找不到依赖项 dll。但显然 dll 与 someprogram.dll 位于同一文件夹中,该消息专门提示缺少“lib/dotnetstandard2.0/someassembly.dll”处的程序集。这是为什么? dll应该在哪里?

这是Dockerfile :

FROM microsoft/dotnet:2.2-sdk AS build 
WORKDIR /app
COPY . .
WORKDIR /app/WebService
RUN dotnet build -c Release -o /app/out

FROM build AS publish
RUN dotnet publish -c Release -o /app/out

FROM microsoft/dotnet:2.2-aspnetcore-runtime
WORKDIR /app
COPY --from=build /app/out . ENTRYPOINT ["dotnet", "WebService.dll"]

最佳答案

事实证明,这条线造成了麻烦。

FROM build AS publish

注释掉后,该应用程序开始工作。

这是 Dockerfile
FROM microsoft/dotnet:2.2-sdk AS build 
WORKDIR /app

COPY . .

WORKDIR /app/WebService
RUN dotnet publish -c Release -o /app/out

FROM microsoft/dotnet:2.2-aspnetcore-runtime
WORKDIR /app
COPY --from=build /app/out .

ENTRYPOINT ["dotnet", "WebService.dll"]

关于docker - 未找到 asp.net 核心 docker linux 程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56141368/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com