0

I can't access containerised .NET services from host when dll started from remote VSCode's debugger.

I can access the services

  • from host machine when the dll is run manually with the dotnet command
  • from container (using curl) when dll is run manually or with VSCode debugger

Sample repository: https://github.com/matrumz/stackoverflow-devcontainers-ports-debug

Can access from host when manually run

can access from host when manually run

Results when launched with VSCode debugger

listening on 5000 curl works in container access fails from host

Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
matrumz
  • 117
  • 1
  • 1
  • 11

1 Answers1

0

When the program is launched with the dotnet command, the app listens on http://[::]:80, but the debugger listens on http://localhost:5000.

Lord knows what I'm breaking by doing this, but changing

    "stackoverflow_devcontainers_ports_debug": {
...   
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
...
    }

to

    "stackoverflow_devcontainers_ports_debug": {
...   
      "applicationUrl": "https://localhost:5001;http://0.0.0.0:5000",
...
    }

solved the issue (just working on HTTP for now).

If someone wants to educate me WHY this works, I'm all ears. Until then: I'll continue to solve problems by copying things that already work!

matrumz
  • 117
  • 1
  • 1
  • 11