ubuntu - Visual Studio Code Ubuntu aspnet core 2 容器调试

标签 ubuntu docker asp.net-core visual-studio-code asp.net-core-2.0

我用谷歌搜索并查看了stackoverflow,但找不到解决方案。

设置:

主机操作系统:Ubuntu

ASPNet 核心 2

点网2.0

我有两个容器,一个用于 MySQL,另一个用于 dotnet core。我能够在不安装 CLR 调试器的情况下运行它。在一个容器中安装 CLR 调试器后,我尝试使用 Visual Studio Code 调试在该容器中运行的 aspnet core 2 应用程序。我收到以下错误:

“管道程序 'bash' 意外退出。”

唯一的选择是“打开 Launch.json”,并且在 launch.json 中只有 bash 命令是:

        "pipeTransport": {            
            "pipeProgram": "/bin/bash",            
            "pipeCwd": "${workspaceRoot}",            
            "pipeArgs": ["-c",            
                "docker exec -i devexamapp_debug_1 /clrdbg/clrdbg --interpreter=mi"],
            "debuggerPath": "/vsdbg/vsdbg"

调试控制台显示如下:

开始: "/bin/bash"-c "docker exec -i devexamapp_debug_1/clrdbg/clrdbg --interpreter=mi""/vsdbg/vsdbg --interpreter=vscode"

如果我在控制台窗口中运行 "/bin/bash"-c "docker exec -i devexamapp_debug_1/clrdbg/clrdbg --interpreter=mi""/vsdbg/vsdbg --interpreter=vscode"那么它可以 100% 正常工作错误。

我错过了什么?有什么帮助吗?

谢谢

最佳答案

编辑 1:10 月 14 日

您需要在 Docker 镜像中安装调试器。您可以通过将以下内容添加到您的 dockerfile 来执行相同的操作

WORKDIR /vsdbg 
RUN curl -SL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /vsdbg

然后你需要更新pipeTransportlaunch.json如下
"pipeTransport": { 
   "pipeProgram": "docker", 
   "pipeCwd": "${workspaceRoot}", 
   "pipeArgs": ["exec -i devexamapp_debug_1"], 
   "debuggerPath": "/vsdbg/vsdbg", 
   "quoteArgs": false 
}

关于ubuntu - Visual Studio Code Ubuntu aspnet core 2 容器调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46698532/

相关文章:

ubuntu - 没有生成 crontab 核心转储?

google-app-engine - Google App Engine PHP SDK - 如何在 Ubuntu (15.10) 上安装?

python - Ubuntu 中的多个版本的 Python

docker - elasticsearch-1.6 连接到其 docker 容器时无法初始化类 org.elasticsearch.monitor.jvm.JvmInfo

docker - 如何修复 gyp ERR!在 npm 构建中

c# - 无法通过 Windows 上的 Docker 访问 .Net Core 应用程序(本地主机)

ubuntu - SFTP 和 SCP 文件传输停止

testing - 通过文件初始化 Elasticsearch 数据库

c# - Serilog 依赖注入(inject)

asp.net-core - 项目引用使我能够使用其他依赖项目的代码,而无需明确的项目引用