首页 > 解决方案 > Cannot Attach Debugger with Docker Containers in Visual Studio 2019 - Errors

问题描述

I am trying to run the Visual Studio debugger using after building my containers with docker-compose. The containers build fine and start up and are all listed in the containers view. The output windows shows everything to be fine and then issues 8 commands for each service:

========== Debugging ==========
docker ps --filter "status=running" --filter "label=com.docker.compose.service" --filter "name=^/dataapi$" --format {{.ID}} -n 1
e2490aa5ec53
docker ps --filter "status=running" --filter "label=com.docker.compose.service" --filter "name=^/statisticsapi$" --format {{.ID}} -n 1
275a0475c7f6
docker ps --filter "status=running" --filter "label=com.docker.compose.service" --filter "name=^/wellspacingapi$" --format {{.ID}} -n 1
99a1b4c77f28
docker ps --filter "status=running" --filter "label=com.docker.compose.service" --filter "name=^/dataworkflowsapi$" --format {{.ID}} -n 1
b900708dc919
docker ps --filter "status=running" --filter "label=com.docker.compose.service" --filter "name=^/griddingapi$" --format {{.ID}} -n 1
6d05117e9f5a
docker ps --filter "status=running" --filter "label=com.docker.compose.service" --filter "name=^/apigatewayocelot$" --format {{.ID}} -n 1
542dfca93543
docker ps --filter "status=running" --filter "label=com.docker.compose.service" --filter "name=^/identityserver$" --format {{.ID}} -n 1
74b5552affaa
docker ps --filter "status=running" --filter "label=com.docker.compose.service" --filter "name=^/loginserverapi$" --format {{.ID}} -n 1
c4ff67ab6a7a

I then get a "Microsoft Visual Studio" error dialog 8 times, one for each microservice, that says:

One or more errors occurred.

Failed to launch debug adapter.  Additional information may be available in the output window.

The operation was cancelled.

The program '' has exited with code -1 (0xffffffff).
The program '' has exited with code -1 (0xffffffff).
The program '' has exited with code -1 (0xffffffff).
The program '' has exited with code -1 (0xffffffff).
The program '' has exited with code -1 (0xffffffff).
The program '' has exited with code -1 (0xffffffff).
The program '' has exited with code -1 (0xffffffff).
The program '' has exited with code -1 (0xffffffff).

A picture of the dialog:

enter image description here

What's even more frustrating is that my colleague has the exact same machine and software and version of the software as me and it works for him. My software version:

Visual Studio: 16.9.2
Docker version 20.10.5, build 55c4c88

dotnet --info:

.NET SDK (reflecting any global.json):
 Version:   5.0.201
 Commit:    a09bd5c86c

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.201\

Host (useful for support):
  Version: 5.0.4
  Commit:  f27d337295

.NET SDKs installed:
  5.0.201 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

I have researched other problems that are similar, but none of their resolutions have worked for me. Any help is greatly appreciated!!

标签: visual-studiodockerasp.net-core.net-coredocker-compose

解决方案


推荐阅读