使用Visual Studio2019远程调试连接Win2016

Remote debugging using Visual Studio 2019 connected to Win2016

我只是想知道是否有人可以帮助我找出“Visual Studio 远程调试工具”在连接到远程 Windows 2016 操作系统的 C# 应用程序上失败的原因?

为了让你知道我做了什么,我已经 gone here and downloaded the Remote Tools for 2019 并在 2016 盒子上成功安装了它。

在服务器上,我也手动添加了以下防火墙规则,开放了4024端口(只是为了确定)

netsh advfirewall firewall add rule name="VisualStudio_Debug_4024_TCP_IN" dir=in action=allow protocol=TCP localport=4024
netsh advfirewall firewall add rule name="VisualStudio_Debug_4024_TCP_OUT" dir=out action=allow protocol=TCP localport=4024
netsh advfirewall firewall add rule name="VisualStudio_Debug_4024_UDP_IN" dir=in action=allow protocol=UDP localport=4024
netsh advfirewall firewall add rule name="VisualStudio_Debug_4024_UDP_OUT" dir=out action=allow protocol=UDP localport=4024

在服务器上,当我运行“Visual Studio远程调试器”时,我运行它是管理员,当我连接Visual studio时,我看到了我自己连接到 运行 在服务器上正常运行的“远程调试器应用程序”。

然后,在我的笔记本电脑上,在 Visual Studio 中,当我转到“调试”->“附加到进程”并输入 Win2016 服务器名称时,它会显示所有应用程序的任务列表 运行在服务器上 ning(虽然在加载列表时有点慢)

但是,当我点击“附加”时,我得到了旋转的死亡圆圈,最后弹出了这个错误!

它说远程调试器似乎没有在远程机器上 运行ning,但它显然是因为它允许我获取任务列表而且我还可以看到自己在 [=服务器上的“远程调试器”的 45=]!!

我不知道从这里可以做什么,也不知道还能做什么,我一直在挠头。有谁知道我还能在哪里查看问题所在?

如有任何帮助或指导,我们将不胜感激。干杯。

感谢 Ian Kemp 在这方面为我指明了正确的方向。

page 列出远程计算机上需要在远程调试工作之前打开的端口。您需要打开的端口是:

  • 端口 4024
  • 端口 4025
  • 端口3702(这个是可选的,我自己没有打开这个端口)

显然,对于 Visual Studio 的每个新版本发布,端口号都会增加 2。

我打开了端口 4024 但没有打开 4025。要打开这些端口,我 运行 服务器和本地笔记本电脑上的这个批处理文件。

REM Open Port 4024    
netsh advfirewall firewall add rule name="VisualStudio_Debug_4024_TCP_IN" dir=in action=allow protocol=TCP localport=4024
netsh advfirewall firewall add rule name="VisualStudio_Debug_4024_TCP_OUT" dir=out action=allow protocol=TCP localport=4024
netsh advfirewall firewall add rule name="VisualStudio_Debug_4024_UDP_IN" dir=in action=allow protocol=UDP localport=4024
netsh advfirewall firewall add rule name="VisualStudio_Debug_4024_UDP_OUT" dir=out action=allow protocol=UDP localport=4024

REM Open Port 4025
netsh advfirewall firewall add rule name="VisualStudio_Debug_4025_TCP_IN" dir=in action=allow protocol=TCP localport=4025
netsh advfirewall firewall add rule name="VisualStudio_Debug_4025_TCP_OUT" dir=out action=allow protocol=TCP localport=4025
netsh advfirewall firewall add rule name="VisualStudio_Debug_4025_UDP_IN" dir=in action=allow protocol=UDP localport=4025
netsh advfirewall firewall add rule name="VisualStudio_Debug_4025_UDP_OUT" dir=out action=allow protocol=UDP localport=4025

嘿嘿!它开始工作了!