Failed to load the application or run the command "Microsoft.AspNet.Server.Kestrel". Available commands: web

Trying to run a simple webapi application on docker (deployed on Ubuntu Linux), I encounter a strange exception when trying to start the container:
Failed to load the application or run the command "Microsoft.AspNet.Server.Kestrel". Available commands: web.

What I have done so far .. I downloaded my aspnet5 solution to a Linux machine and started publishing it: dnu publish --framework dnxcore50 --configuration Release --wwwroot "wwwroot" --wwwroot-out "wwwroot" - -iis- command "web"

Then create a docker assembly to create the image, and then try to run it with: sudo docker run -t -d -p 8000: 8000 myimagename

Looking at the docker logs, I see the exception shown above.

I checked into the container to see the folder structure and everything looks good. The Verifyid dnx in the container and the one I used to build are the same.

Using the latest available microsoft / aspnet image - rc1-update1

Any ideas?

+4
source share
1 answer

I managed to get it working by executing these commands in a Docker file before ENTRYPOINT:

ADD ./app
#SOLUTION
WORKDIR path_to_your_sources
RUN dnu restore
#########
WORKDIR /app/approot
ENTRYPOINT "./web"

Although the error message suggests that the "Microsoft.AspNet.Server.Kestrel" command in

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  }

It would be very strange, but to check if this was the case, I tried:

    "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "Microsoft.AspNet.Server.Kestrel": "Microsoft.AspNet.Server.Kestrel"
  }

. dnu restore , .

+1

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


All Articles