I'm facing issues while running my application built on ASP.NET Core using Docker in Visual Studio. My application only uses dnxcore50 framework. My project.json file is:
{
"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"
}
}
I have tried following approaches:
- When my dnvm points to runtime dnx-coreclr-win-x64.1.0.0-rc1-update1 as shown in figure below.
My application builds successfully. But, I get following error on running/debugging the application on docker and my application gets stuck at "Opening site http://192.168.99.100:5000"
Error details: The Current runtime framework is not compatible with 'app' The current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)' Please make sure the runtime matches the framework specified in project.json
- As the above error message suggests there is mismatch in framework, I changed the default and active runtime to dnx-coreclr-linux-x64.1.0.0-rc1-update1 by modifying default alias and executing command
dnvm use default -p
. Then, I restart my VS (to make sure the changes are visible in VS).
However, my application still builds on DNX version v4.5.1 as suggested in the build logs below:
1> Information: [LoaderContainer]: Load name=Microsoft.Dnx.Tooling
1> Information: [PathBasedAssemblyLoader]: Loaded name=Microsoft.Dnx.Tooling in 2ms
1> Information: [Bootstrapper] Runtime Framework: DNX,Version=v4.5.1
1> Microsoft .NET Development Utility Mono-x64-1.0.0-rc1-16231
Hence, the application again fails to run with the same error as in point 1.
Additionally, on changing the default runtime dnu restore stops working from command line and gives with following error:
'dnu' is not recognized as an internal or external command, operable program or batch file.
Interestingly, the 'dnu' restore command continues to work from VS (as suggested in VS build logs).
- I then tried to change dnvm runtime to dnx-mono.1.0.0-rc1-update1. But it fails with following error:
Cannot find dnx-mono.1.0.0-rc1-update1.1.0.0-rc1-update1, do you need to run 'dnvm install default'? At C:\Program Files\Microsoft DNX\Dnvm\dnvm.ps1:1659 char:9 + throw "Cannot find $runtimeFullName, do you need to run '$Com ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Cannot find dnx...stall default'?:String) [], Run timeException + FullyQualifiedErrorId : Cannot find dnx-mono.1.0.0-rc1-update1.1.0.0-rc1-update1, do you nee d to run 'dnvm install default'?
What runtime I need to use to run docker from VS and how I can change it? Request your help to resolve the issue.
Update
I was finally able to resolve the issue by changing the docker file first line to FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr
FROM microsoft/aspnet:1.0.0-rc1-update1
. Thanks @bertt for the tip.