5

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:

  1. When my dnvm points to runtime dnx-coreclr-win-x64.1.0.0-rc1-update1 as shown in figure below.

enter image description here

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" enter image description here

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

  1. 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).

enter image description here

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).

  1. 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.

2
  • Please transcribe the contents of all screen shots so the text can be read (when small), can be read (when in a medium such as a syndication feed that doesn't permit images), can be read (when the image link eventually breaks) and can be searched. Commented Apr 2, 2016 at 20:42
  • @ErikE added the image details as text Commented Apr 3, 2016 at 5:00

2 Answers 2

2
+50

what's in the first line of your dockerfile? should be 'FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr' for CoreClr

Sign up to request clarification or add additional context in comments.

2 Comments

The first line of docker file is: FROM microsoft/aspnet:1.0.0-rc1-update1
@Bret, I had the docker file generated by default from Visual Studio. Which had wrong runtime version. Changing the docker file content to 'FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr' helped resolved the issue.Thanks for your help.
1

I read about this in a similar post here on stackoverflow

The problem may be that Kestrel only listens to localhost by default.

You may want to change your dockerfile containing:

ENTRYPOINT ["dnx", "web", "--server.urls", "http://0.0.0.0:5000"]

or alternatively just modifying the last part of your project.json to

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel --server.urls http://0.0.0.0:5000"
  }

might also work.

1 Comment

Hi Bauer, thanks for your help. I tried to change my dockerfile and project.json but it didn't help. :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.