ArkadyB
ArkadyB

Reputation: 1275

Unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel'. Available commands: web

Trying to run simple webapi application on docker (deployed to Ubuntu Linux) i face strange exception when attempting to run container:
Unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel'. Available commands: web.

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

Next ive done docker build to create an image and then try to run it with: sudo docker run -t -d -p 8000:8000 myimagename

Looking at the docker logs i see an exception shown above.

Ive logged into the container to see folders structure and all look good. Verifyid dnx in container and the one i used to build solution are the same.

Using latest available microsoft/aspnet image - rc1-update1

Any ideas??

Upvotes: 4

Views: 899

Answers (1)

Miguel Marques
Miguel Marques

Reputation: 2856

I was able to get it working by runnning this commands in the Dockerfile before the ENTRYPOINT:

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

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

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

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

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

And it didn't work. dnu restore fixed it, don't know the relation to the error message yet.

Upvotes: 1

Related Questions