我正在尝试在Alpine .net Core Docker映像中运行dotnet Core 2.2控制台应用程序。
在我的Windows计算机上,该应用程序正在运行-在docker容器上,该应用程序也正在运行,但是每个响应的状态均为200,其中包含空内容。
容器日志看起来不错。
这是我的DockerFile:
#FROM mcr.microsoft.com/dotnet/core/runtime:2.2-alpine as base
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine as base
WORKDIR /app
EXPOSE 11007
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine as builder
COPY . /app
WORKDIR /app/Common
RUN ["dotnet", "restore"]
WORKDIR /app/DataAccess
RUN ["dotnet", "restore"]
WORKDIR /app/ERPSystem
RUN ["dotnet", "restore"]
WORKDIR /app/GlobalLibrary
RUN ["dotnet", "restore"]
WORKDIR /app/Hoster
RUN ["dotnet", "restore"]
WORKDIR /app/Model
RUN ["dotnet", "restore"]
WORKDIR /app/Service
RUN ["dotnet", "restore"]
WORKDIR /app/Hoster
#RUN ["dotnet", "build"]
RUN dotnet build -c Debug -o /result
FROM builder AS publish
RUN dotnet publish -c Debug -o /result
FROM base AS final
COPY ["settings.json", "/usr/share"]
WORKDIR /app
COPY --from=publish /result .
ENTRYPOINT ["dotnet", "Hoster.dll"]
答案 0 :(得分:0)
控制器位于另一个程序集中(文件夹“ Controllers”中startup.cs旁边)。在Linux上,我必须使用“ services.AddMvc()。AddApplicationPart(typeof(somecontrollerclass).Assembly);”而不是“ services.AddMvc();” (都在Windows上运行)。