views:

97

answers:

2

I have a Windows 7 machine hosting a Windows 7 virtual machine. I am developing a web application using visual studio 2010 on my host machine. I want to run the application in debug mode and access my localhost server from a browser on the virtual machine. (The purpose of this is to be able to debug an application that uses Windows Authentication using different users without having to log off and on for different users on my host machine...)

I am using a bridged connection for the virtual machine. I googled how to solve this problem and most of the threads that I found said that if I was using a bridged connection, I could access the server on the host machine by just entering the IP address of my host machine into the url in the browser of the virtual machine. I have tried some different urls using the IP but none of them have worked.

As an example, suppose I run my web application in visual studio on my host machine and its url is

http://localhost:62789/MyPage.aspx

Assume also that I ran ipconfig in CommandPrompt on my host machine and found out that the IP address for my host machine is xxx.xxx.xxx.x. What url should I enter on the virtual machine to access my web application?

Thanks in advance.

EDIT:

I set up IIS to host the web project. After that, I just added the following line (xxx.xxx.xxx.xxx is my IP) to my hosts file and I was able to access the website from the virtual machine:

xxx.xxx.xxx.xxx MyWebsite.net

I also had to edit my firewall settings.

+2  A: 

I personally found it easiest to setup my virtual machine using the Microsoft Loopback Adapter, and assigning the virtual machine to that adapter. The Guest OS will be assigned it's own IP with DHCP. Using the Loopback Adapter will basically put your host and guest OS on the same network. The guest will only be able to access the host, and will not be able to access the internet.

You could then access the host from the guest using whatever ip address you see on the host(run ipconfig/all on the host).

Edit: FYI I am using Virtual PC so your milage may vary. THe Loopback Adapter is a free download from Microsoft.

Edit2: You will probably need to open ports on the host machine to allow access to the web server also. The guest OS's request will still be going through the Windows firewall

AaronLS
+2  A: 

It seems like you might be using VisStudio's integrated Web Server. I'm not sure this can accept requests from any host other than localhost.

http://stackoverflow.com/questions/220274/remote-machines-cannot-connect-to-visual-studio-web-server

Simple solution? Use IIS to host the project. Once IIS is installed (if not already) it's easy to change the project settings such that a virtual directory is created and debugging occurs in IIS.

spender