我在使用Visual Studio中的Docker运行构建在ASP.NET Core上的应用程序时遇到问题.我的应用程序只使用dnxcore50框架.我的project.json文件是:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"
},
"frameworks": {
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
],
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了以下方法:
我的应用程序成功构建 但是,我在docker上运行/调试应用程序时遇到以下错误,我的应用程序卡在"打开站点http://192.168.99.100:5000 "

错误详细信息: 当前运行时框架与'app'不兼容当前运行时目标框架:'DNX,Version = v4.5.1(dnx451)'请确保运行时与project.json中指定的框架匹配
dnvm use default -p.然后,我重启我的VS(以确保在VS中可以看到更改).但是,我的应用程序仍然建立在DNX版本v4.5.1上,如下面的构建日志中所示:
1> Information: [LoaderContainer]: Load name=Microsoft.Dnx.Tooling
1> Information: [PathBasedAssemblyLoader]: Loaded name=Microsoft.Dnx.Tooling in 2ms
1> Information: …Run Code Online (Sandbox Code Playgroud) I am going to push my asp.net core 1.0 code from Windows environment to remote Linux docker container. Basically the container will host the application as the server.
Now I see the different configuration for ENTRYPOINT in different blogs.
ENTRYPOINT ["./kestrel"] at http://blog.dudak.me/2015/deploying-aspnet-5-applications-to-docker-containers/ENTRYPOINT ["dnx", "-p", "project.json", "web"] at Cannot run asp.net 5 from dockerENTRYPOINT ["dnx", "./src/HelloMvc6", "kestrel"] at https://alexanderzeitler.com/articles/Running-ASP.NET-5-beta4-in-Docker-with-DNX-runtime/ENTRYPOINT ["./web"] if using http://www.hanselman.com/blog/PublishingAnASPNET5AppToDockerOnLinuxWithVisualStudio.aspx我是码头工人的新手。我不知道其中的区别,也不知道可以使用哪一个。
我一直在Docker容器中使用ASP.NET 5.0 beta 7运行一个网站,使用官方Docker镜像 - https://github.com/aspnet/aspnet-docker - 工作正常.
我最近将我的项目更新为beta 8,并将Dockerfile更改为使用了Docker映像的beta 8版本.当我在Windows机器上本地运行它时,一切正常,无论我使用Visual Studio通过IIS Express启动项目,还是使用Kestrel运行它.
但是,然后我把它推到我的Dokku服务器,它似乎没有正常启动.我没有从容器输出中得到任何错误,但我有一个CHOKS文件,Dokku用它来确保Web服务器已经启动,这失败了(表明它没有正确启动,或者没有按原样收听) .我试图删除CHECKS,我也无法连接到它 - 我从nginx收到一个错误的网关消息.
我不知道为什么会这样,因为当我推到Dokku时,我收到以下回复:
...
remote: [1G-----> Attempt 5/5 Waiting for 10 seconds ...[K
remote: [1G CHECKS expected result:[K
remote: [1G http://localhost/ => "My Website"[K
remote: Could not start due to 1 failed checks.[K
remote: [1G ! [K
remote: [1Gcurl: (7) Failed to connect to 172.17.2.14 port 5000: Connection refused[K
remote: [1G ! Check attempt 5/5 failed.[K
remote: [1G=====> mywebsite container output:[K
remote: [1G info : …Run Code Online (Sandbox Code Playgroud)