I have installed ASP.NET Core 2.1 preview 1 from here and the latest preview of Visual Studio.
Then I follow the steps: File > New Project > ASP.NET Core Web Application > Choose API
, check Enable Docker Support (Os: Linux)
and No Authentication
.
This nicely generates project template, as well as a Docker project with docker compose files. This builds fine, and pulls all the required images. However, when I try to run it with Docker, from within Visual Studio, it doesn't seem to work.
In the logs I see the following:
Content root path: /app
Now listening on: http://[::]:80
...
Request starting HTTP/1.1 GET http://localhost:32778/ Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:32778/
Now, when I try to do a GET to http://localhost:32778/api/values (using Postman), no response is seen:
Could not get any response There was an error connecting to http://localhost:32778/api/values.
BUT! The Docker logs show that the request is being made:
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:32778/api/values
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:32778/api/values
[40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] Request finished in 14.4873ms 307 Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 14.4873ms 307
What am I missing here? If I run the default project with IIS Express, everything works as expected.
EDIT: I've just tested this on ASP.NET Core 2.0, and everything works just fine.