【发布时间】:2021-03-25 00:42:09
【问题描述】:
我用下面的 Dockerfile 创建了一个 .NET 5 ASP.NET Web 应用程序。
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /source
# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore
# copy and publish app and libraries
COPY . .
RUN dotnet publish -c release -o /app --no-restore
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:5.0
EXPOSE 3000
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["./TestNET5"]
我在 Azure Web 应用程序的配置设置中添加了变量 PORT 和 WEBSITES_PORT,值为 3000,我还添加了 -e environment=Production -e ASPNETCORE_ENVIRONMENT=Production,但我仍然收到以下错误。
Container xxx didn't respond to HTTP pings on port: 3000, failing site start. See container logs for debugging.
我在这里失踪了吗?我已经检查了几篇文章,但似乎找不到解决方案。
【问题讨论】:
-
Azure Web 应用仅支持 http 80 和 https 443 端口。
-
80 端口也不行。在 Azure 中将 WEBSITES_PORT 和 PORT 设置为 80 似乎无法解决问题。
-
关于这个问题的任何更新?它解决了你的问题吗?
标签: .net-5 azure-container-registry