skip to Main Content

After creating an ASP.NET Core app from web template in Visual Studio and clicking Add Docker Support, it runs fine in debug mode initiated by Visual Studio.

However if debugging is stopped in Visual Studio then the container no longer responds even though it is still running and can be entered via terminal etc. The ports are still listening but it just doesn’t work anymore.

Start debugging

enter image description here

enter image description here

enter image description here

enter image description here

Stop debugging

enter image description here

All other info above remains the same with no indication the container is even aware Visual Studio has stopped. The container is still accessible:

enter image description here

The mapped ports are still listening so there is a process backing the socket:

enter image description here

But the site no longer works:

enter image description here

What is Visual Studio doing to make this container respond? Where is the documentation for it?

2

Answers


  1. Have you tried Ctrl+F5 (start without debugging)? also change the settings in Tools-Configuration-Containers then look for the options where it gets rid of the containers on close and set them to false. That allowed me to run my asp page with docker without debug being active in VS22.

    Login or Signup to reply.
  2. Apparently Visual Studio does some tricks when building for debugging so the image doesn’t work without VS. If you build the image yourself with docker build, it’ll work in Docker Desktop.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search