VMware Communities
ahmd9
Enthusiast
Enthusiast

Access localhost on the main machine from VMware Workstation 8 for ASP.NET development test

I run an ASP.NET Development Server (that came with MS Visual Studio 2010) on my Windows 7 machine. I'm currently developing an ASP.NET C# web application and to test it on Windows 7 machine I need to navigate my web browser to an address like this:

http://localhost:59215/Default.aspx

I also have the VMware Workstation 8 installed on that Windows 7 with other OS as virtual machines. I need to try to load my web app from those virtual machines, but when I type the above address there I get "Cannot display page" error in a browser. Note that I can access internet from a virtual machine itself, but for some reason localhost on the main machine is not accessible.

Any ideas how to set this up?

Tags (2)
0 Kudos
3 Replies
WoodyZ
Immortal
Immortal

I'm often surprised how many "web type developers" do not even understand the rudimentary basics of networking, "localhost" is just that, local to the host and is not intended to be reachable beyond itself.

In other words each system, physical or virtual, has it's own "localhost" and is normally by default set to 127.0.0.1 and is a loopback adapter and not routed beyond the host itself.  Therefore when accessing "localhost" from any system one is accessing that system itself and not another system that might actually have the resource one is really trying to access.

If you want to access a resource of one system from another then use a properly formed URL to do so and as an example do not use localhost in the URL from a Virtual Machine trying to access "localhost" on the Physical Machine.  Instead use the actual targets IP Address in the URL.

Also if necessary properly configure all Firewalls involved to allow for proper communication between systems.

0 Kudos
ahmd9
Enthusiast
Enthusiast

OK, I appreciate your (derisive) answer. I guess now I need to configure the firewall that comes with VMware workstation. The reason I say this is because I do not have any firewalls on my Windows 7 Ultimate machine. I know that Windows 7 has a built-in firewall but that's pretty much it.

So I went to ipconfig (on a host computer -- Windows 7) and got this:

C:\Windows\System32>ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
Wireless LAN adapter Wireless Network Connection:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::2d70:f50:45db:4e9d%10
   IPv4 Address. . . . . . . . . . . : 192.168.0.4
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.0.1
Ethernet adapter VMware Network Adapter VMnet1:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::51d1:de6d:517d:61fb%14
   IPv4 Address. . . . . . . . . . . : 192.168.158.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
Ethernet adapter VMware Network Adapter VMnet8:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::f069:a4ab:2da0:e535%15
   IPv4 Address. . . . . . . . . . . : 192.168.109.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
Ethernet adapter VMware Network Adapter VMnet0:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::a4de:44f9:e43a:aea7%17
   IPv4 Address. . . . . . . . . . . : 192.168.91.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
Tunnel adapter isatap.{E3766B7A-3202-43CA-B4DA-69B6AB8802BB}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
Tunnel adapter Teredo Tunneling Pseudo-Interface:
   Connection-specific DNS Suffix  . :
   IPv6 Address. . . . . . . . . . . : 2001:0:4137:9e76:140a:1045:be9b:c0b7
   Link-local IPv6 Address . . . . . : fe80::140a:1045:be9b:c0b7%13
   Default Gateway . . . . . . . . . : ::
Tunnel adapter isatap.{1F10262A-F02B-4A8E-B78C-2B185836E3EB}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
Tunnel adapter isatap.{EF2D5E0D-6777-495A-BA82-CC334DD660E9}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
Tunnel adapter isatap.{E24BC668-2767-411C-B922-244CCFCF32F2}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
Tunnel adapter isatap.{0E5AB0F0-FAE1-4481-ADB7-67DE251D11E2}:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
C:\Windows\System32>

When I do ipconfig on a virtual machine (Windows Vista) I get this:

C:\Users\Dev>ipconfig


Windows IP Configuration



Ethernet adapter Local Area Connection:


   Connection-specific DNS Suffix  . : localdomain

   Link-local IPv6 Address . . . . . : fe80::b832:52ba:7a1e:b55b%10

   IPv4 Address. . . . . . . . . . . : 192.168.109.134

   Subnet Mask . . . . . . . . . . . : 255.255.255.0

   Default Gateway . . . . . . . . . : 192.168.109.2


Tunnel adapter Local Area Connection* 6:


   Media State . . . . . . . . . . . : Media disconnected

   Connection-specific DNS Suffix  . : localdomain


Tunnel adapter Local Area Connection* 7:


   Connection-specific DNS Suffix  . :

   IPv6 Address. . . . . . . . . . . : 2001:0:4137:9e76:2464:1f39:3f57:9279

   Link-local IPv6 Address . . . . . : fe80::2464:1f39:3f57:9279%11

   Default Gateway . . . . . . . . . : ::


C:\Users\Dev>

So I'm assuming that my IP on the host Windows 7 machine is 192.168.0.4 but when I use the following from the IE in a virtual Windows Vista it still doesn't work:

http://192.168.0.4:59215/Default.aspx

0 Kudos
ahmd9
Enthusiast
Enthusiast

OK, I got it. The issue was not in VM, but still for those who're interested here's the solution:

http://stackoverflow.com/questions/10158771/access-localhost-on-the-main-machine-from-vmware-worksta...

0 Kudos