Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to remote debug a VirtualBox with visual studio?

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.

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.


Thanks to Mark I got things working, I'll note all the steps I had to take for future reference:

  1. Change the VM network from NAT to Bridged Adapter (have to power off the VM first)
  2. In the guest OS change the default security setting to Classic - local users authenticate as themselves as described here:

    • Control Panel -> Administrative Tools -> Local Security Policy
    • Local Policies -> Security Options
    • Change Network access: Sharing and security model for local accounts to Classic - local users authenticate as themselves
  3. Reboot guest OS

  4. Disabled the firewall on the guest OS
    • If msvsmon can't do it by itself
    • firewall.cpl
like image 927
Motti Avatar asked Oct 18 '09 13:10

Motti


People also ask

How do I remotely access VirtualBox virtual machine?

To do this, open up VirtualBox, select the VM to be configured, click on Display | Remote Display. Make sure Enable Server is enabled and the Server port is set to 3389 (Figure A). If your network won't allow port 3389, you'll need to find a port that can be accessed over your internal network.

How do I debug a remote process in Visual Studio?

Select Configure remote debugging to configure the firewall and start the remote debugger. When configuration is complete, the Remote Debugger window appears. The remote debugger is now waiting for a connection. Use the server name and port number shown to set the remote connection configuration in Visual Studio.


1 Answers

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.

like image 160
Mark Hall Avatar answered Sep 26 '22 12:09

Mark Hall