aspnetcore2.1 部署到docker (访问出现404)

Dockerfile

FROM microsoft/dotnet:2.1-aspnetcore-runtime
WORKDIR /app
COPY ./publish .
ENTRYPOINT ["dotnet", "WebApiTestNew1.dll"]

Program.cs

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseContentRoot(Directory.GetCurrentDirectory()) // 这段解决部署到docker中,出现404错误
.UseStartup<Startup>();

出现404的原因: https://blog.agchapman.com/resolving-404-errors-when-publishing-asp-net-core-for-docker/

上一篇:Windows Azure案例分析: 选择虚拟机或云服务?


下一篇:Fiddler对https抓包时,提示"HTTPS decryption is disabled."原因及破解