visual-studio 是否可以使用 Visual Studio 远程调试 VirtualBox?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1584939/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to remote debug a VirtualBox with visual studio?
提问by Motti
I'm running different versions of our application on Sun's open source VirtualBox, is it possible to remote debug the app from the host OS with Visual Studio? The problem is that in Visual Studio when I want to attach to a remote machine I have to enter either a computer name or IP and the IP I get from within the virtual box isn't pingable from the host machine.
我在 Sun 的开源VirtualBox上运行不同版本的应用程序,是否可以使用 Visual Studio 从主机操作系统远程调试应用程序?问题是,在 Visual Studio 中,当我想连接到远程机器时,我必须输入计算机名称或 IP,而我从虚拟机中获得的 IP 无法从主机 ping 通。
I'm primarily interested in debugging native code (so I can run with no authentication) but if there's a way to debug managed code too please let me know.
我主要对调试本机代码感兴趣(所以我可以在没有身份验证的情况下运行)但是如果有一种方法也可以调试托管代码,请告诉我。
I should note that the host OS is Vista and the guest is XP.
我应该注意到主机操作系统是 Vista,来宾操作系统是 XP。
Thanks to Mark I got things working, I'll note all the steps I had to take for future reference:
多亏了马克,我才开始工作,我会记下我必须采取的所有步骤以供将来参考:
- Change the VM network from
NATtoBridged Adapter(have to power off the VM first) In the guest OS change the default security setting to
Classic - local users authenticate as themselvesas described here:Control Panel -> Administrative Tools -> Local Security PolicyLocal Policies -> Security Options- Change
Network access: Sharing and security model for local accountsto Classic - local users authenticate as themselves
Reboot guest OS
- Disabled the firewallon the guest OS
- If
msvsmoncan't do it by itself firewall.cpl
- If
- 将 VM 网络从 更改
NAT为Bridged Adapter(必须先关闭 VM) 在来宾操作系统中,将默认安全设置更改为
Classic - local users authenticate as themselves如下所述:Control Panel -> Administrative Tools -> Local Security PolicyLocal Policies -> Security Options- 更改
Network access: Sharing and security model for local accounts为经典 - 本地用户以他们自己的身份进行身份验证
重新启动来宾操作系统
- 禁用来宾操作系统上的
防火墙
- 如果
msvsmon自己做不到 firewall.cpl
- 如果
采纳答案by Mark Hall
It sounds like your guest setting have NAT for the netowking adapter. Go into the guest setting, choose networking and if the type of network is NAT switch it to Bridged. NAT produces an address range that is not public; whereas, bridged will give the guest OS an IP on the same subnet as the host.
听起来您的访客设置为 netowking 适配器设置了 NAT。进入访客设置,选择网络,如果网络类型是 NAT,则将其切换为桥接。NAT 产生一个不公开的地址范围;而桥接将为来宾操作系统提供与主机在同一子网上的 IP。

