UseContentRoot(Directory.GetCurrentDirectory()) So to fix it, I can tell Kestrel to listen using the UseUrls() method and specify interfaces to listen on: public static void Main(string args) Sort of a bonehead moment on my part but there you are. That doesn’t allow it to be viewed externally from the host. I found out that by default, ASP.NET Core applications only listen on the loopback interface - that’s why it showed me localhost:5000. The syntax for docker -p is HOST:CONTAINER, and I’ve made them 5000 on both sides just for testing, but I’m still not getting a response. It’s listening on localhost (the docker container), and I’ve exposed port 5000, right? Maybe my port settings are wrong when I spin up the container? Let’s check: docker run -i -p 5000:5000 -name my-project -t my-project:latest Docker was set up correctly and ASP.NET Core applications listen on port 5000 typically:Ĭomplete Dockerfile: FROM microsoft/dotnet:1.1.0-runtimeĪRG source=./src/bin/Release/netcoreapp1.1/publishĪSP.NET Core dotnet run output: my-project We use Docker’s Network feature to create a virtual network for our docker containers but for some reason I wasn’t able to issue a curl request against the ASP.NET Docker container, it simply returned: When attempting to Dockerize my ASP.NET Core micro-service, I ran into an interesting issue.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |