从 Visual Studio 2017 连接到适用于 Linux 的 Windows 子系统 [英] Connecting to the Windows Subsystem for Linux from Visual Studio 2017

查看:62
本文介绍了从 Visual Studio 2017 连接到适用于 Linux 的 Windows 子系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望从 VS2017 调试 Linux C++ 控制台应用程序,如这些教程所示:

就我而言,主机名和端口号都是正确的.我知道 WSL 仍然是 Beta,所以我假设问题与 WSL 有关(我最近安装了 Windows 10 Creators Update,所以它至少是最新的,但我期待 ssh与 CU 合作).我使用的是 Windows 10 版本 1703,内部版本 15063.250.

更新我让 Visual Studio 连接到我的 Ubuntu VM,这证明它可以工作,而且问题一定出在 Windows 上的 Bash 上.传入连接没有任何作用,但传出连接按预期工作.

是否有其他人在以这种方式从 Visual Studio 2017 连接到 WSL 时遇到问题?

解决方案

是的,这个问题好像已经被举报了 此处此处.

根据最近对后一个线程的评论,该问题已在 Windows Insider build 16199 中得到解决.根据您的情况,这可能是您的一个选择,直到将修复程序合并到发布版本中.

如果您在生产环境中,我建议您继续使用 VM.我个人在 Windows Insider 构建方面没有遇到太多麻烦,但总是存在一些风险.

I wish to debug a Linux C++ console application from VS2017, as in these tutorials:

Writing And Debugging Linux C Applications From Visual Studio Using The Windows Subsystem For Linux

targeting windows subsystem for Linux from visual studio

I have installed gdbserver and openssh-server in my WSL Ubuntu 16.04 installation, and sshd is running, but I cannot connect from VS2017. When I try, I get the error 'Connectivity Failure. Please make sure the host name and port number are correct'.

Both the host name and port number are correct as far as I am concerned. I know that WSL is still Beta, so I am assuming the problem has something to do with WSL (I recently installed the Windows 10 Creators Update so it is at least up to date, but I was expecting ssh to work with CU). I'm using Windows 10 version 1703, Build 15063.250.

Update I got Visual Studio to connect to my Ubuntu VM, which proves that it works and the problem must be with Bash on Windows. Nothing works with incoming connections, but outgoing connections work as expected.

Has anyone else had problems with connecting to WSL from Visual Studio 2017 in this way?

解决方案

Yes, it looks like this issue has already been reported here and here.

According to a recent comment on the latter thread, the problem has been resolved in Windows Insider build 16199. Depending on your circumstances, this might be an option for you until such time as the fix is incorporated into the release version.

If you are in a production environment, I recommend continuing to use the VM. I've not personally had too much trouble with Windows Insider builds, but there's always some risk involved.

这篇关于从 Visual Studio 2017 连接到适用于 Linux 的 Windows 子系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆