7

Host OS is Win7 running MyApp in the Visual Studio Development Server, bound to localhost:51227, VM is VirtualBox configured with NAT. Guest OS is Win XP with IE7 installed. My goal is to debug MyApp (running on host) from within IE7 (running on guest).

Visual Studio Development server only binds to the loopback network device (i.e. localhost). It does not bind to the external IP address of my host.

I've tried access 10.0.2.2:51227 from IE7 on the guest (and confirmed that 10.0.2.2 is the gateway address using ipconfig), but it appears that 10.0.2.2 binds to the external IP of the Host, NOT the loopback IP (localhost), so this does not work.

Any suggestions?

4
  • 1
    I don't quite understand what you are trying to do. Are you just testing the client-side functionality (layout, Javascript etc.) in IE7 or are you trying to step through the code in the .NET web application itself?
    – James P
    Nov 23, 2012 at 13:31
  • I'd like to test the client-side functionality (but there's a nasty bug in IE7, so I want to be using my dev server to allow quick changes and exploration of the problem). I don't want to have to push builds to a staging server (with a VM accessible IP) after adding every printf or little experiment.
    – Seth
    Nov 23, 2012 at 13:45
  • I'm open to a different solution to my general problem, but the most straightforward solution I can imagine is to be able to just "access host localhost from with ie7 running on the guest VM". Maybe VirtualBox doesn't have this ability though?
    – Seth
    Nov 23, 2012 at 13:46
  • I don't know if it is possible to do what you want but the Visual Studio development web server is not designed to be accessed outside of the context of localhost - that is what IIS is for. Have you tried IETester - my-debugbar.com/wiki/IETester/HomePage ? It allows you to test websites using different versions of IE and I have found that it normally matches the chosen IE version quite closely.
    – James P
    Nov 23, 2012 at 14:00

2 Answers 2

8

The simplest solution for me was to use SPI Port Forward on the Host to allow access to my localhost-only service from an external network interface:

  1. Download SPI Port Forward and Run on the Host (no installer, download is a naked exe)
  2. Important: Windows Firewall will ask if SPI Port Forward is allowed to access Public networks. Check the box to allow access from public networks.
  3. Set Local Port to 8888 (or whatever you want), Remote Host to localhost, Remote port to the port of the target service on the host (in my case 51227, as VSDS is running on port 51227), and click "Activate"
  4. Access 10.0.2.2:8888 from the guest.

Note: If 10.0.2.2 doesn't work, run cmd on the guest to bring up a command line, and use 'ipconfig', and use the default gateway address, but VirtualBox currently defaults to 10.2.2.2 for this, so its a safe bet.

It should be noted that this configuration will allow EXTERNAL IP ACCESS TO VSDS, so use with caution... of course, this could be useful if you wanted to debug mobile phone support or something too.

1
  • You are my savior, I was looking for something simple as SPI Port Forward to test my mobile site over the network through my mobile terminal. This solution worked for me in Windows 8. Jun 18, 2013 at 13:37
0

Although VirtualBox can access the loopback interface on the host (like any other program running on the host), it provides no means for accessing it from a guest OS (which is also the case in other virtualization solutions I know).

If VirtualBox provided access to the host's loopback interface it should create an additional interface on every guest, bound to the loopback interface on the host.

Why this additional interface? Because, on the guest, any traffic sent to 127.0.0.1 would be automatically forwarded to its own loopback interface and not to the host.

I can think of a workaround: Bind Visual Studio Development Server to 10.0.2.2. Like this, your development environment is not accessible from the outside but reachable by the VirtualBox guest (although I read in James's comment above that it may not be possible, I've read recommendations to bind VS to w3p.exe, which seems to work at least on Windows 2003).

2
  • As @James points out, I could switch my development server inside VS from VSDS to IIS... but for some reason my app refuses to work in this mode (works fine on the public IIS), but in any case I'd really rather keep my development configuration the same (not have to monkey with VS settings every time I want to test IE7). I wouldn't expect VirtualBox to merge host-localhost<->guest-localhost, I guess i was hoping it would provide a 2nd interface with a standard IP like 127.0.0.2 or something.
    – Seth
    Nov 24, 2012 at 12:09
  • Too bad it doesn't work... Just as a side note: 127.0.0.2 is also loopback. The whole range 127.0.0.1-127.255.255.254 is reserved for loopback...
    – jaume
    Nov 24, 2012 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .