ASP.NET Kernel - Problems Debugging Through Docker in Visual Studio 2015

I am having problems running my ASP.NET Core-based application using Docker in Visual Studio. My application uses only dnxcore50 . My project.json file:

{ "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 tried the following approaches:

  • When my dnvm points to runtime dnx-coreclr-win-x64.1.0.0-rc1-update1 as shown in the picture below.

enter image description here

My application is working successfully. But I get the following error when launching / debugging the application on the docker, and my application gets stuck on the "Open site http://192.168.99.100و000 " enter image description here

Error details: The current runtime is not compatible with the "application", The current target runtime is: 'DNX, Version = v4.5.1 (dnx451)' Make sure that the runtime matches the structure specified in project.json

  1. As indicated above, the error message indicates a mismatch in the structure, I changed the standard and active runtime to dnx-coreclr-linux-x64.1.0.0-rc1-update1 , changing the default alias and the dnvm use default -p command. Then I restart VS (to make sure the changes are visible in VS).

enter image description here

However, my application is still built on DNX version 4.5, as shown in the following build logs:

 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 

Therefore, the application does not start again with the same error as in paragraph 1.

In addition, when changing the default runtime, dnu restore stops working from the command line and gives the following error:

'dnu' is not recognized as an internal or external command running a program or batch file.

Interestingly, the dnu recovery command continues to work from VS (as suggested in VS build logs).

  1. Then I tried changing the dnvm runtime to dnx-mono.1.0.0-rc1-update1 . But this does not correspond to the following error:

Cannot find dnx-mono.1.0.0-rc1-update1.1.0.0-rc1-update1, do you need to run 'dnvm install by default'? In the folder C: \ Program Files \ Microsoft DNX \ Dnvm \ dnvm.ps1: 1659 char: 9 + throw "Cannot find $ runtimeFullName, 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 , you carry d to run 'dnvm install default'?

What working environment do I need to use to start docker from VS and how can I change it? Ask for your help to solve the problem.

Update Finally, I was able to solve the problem by changing the first line of the docker file to FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr FROM microsoft/aspnet:1.0.0-rc1-update1 . Thanks @bertt for the tip.

+5
source share
2 answers

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

+2
source

I read about it in a similar post here on fooobar.com/questions/997888 / ...

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

You can modify your docker file containing:

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

or alternatively just by changing the last part of your project. json on

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

may also work.

+1
source

Source: https://habr.com/ru/post/1246043/


All Articles