Redirecting Virtual PC's localhost to Host's localhost

Discussion in 'Virtual PC' started by Ken Ismert, Sep 24, 2007.

  1. Ken Ismert

    Ken Ismert Guest

    After installing the Internet Explorer VPC Image (1), which gives you a
    foolproof way to run IE7 alongside IE6, you will probably want to redirect
    the virtual localhost to the localhost running on the host computer.

    The short answer is: you can't.

    The workaround:

    * In this blog entry (2), Fiona Dixon gives a partial answer: use the IP
    address of your host computer. However, this won't redirect your host IP to
    http://localhost, which is required for web servers like Apache to resolve
    local addresses.

    * The next logical step would be to edit the hosts file (3)(4) and add an
    entry which maps localhost to the IP of your host computer. But this won't
    work for IE7 and the .NET framework (5)(6). Requests to localhost and ignore proxies, probably due to this bug (7)

    * The workaround is to configure your web server to respond to your machine
    name instead of localhost (5), and map http://machinename to the IP of your
    host computer in the hosts file.


    * Other posts have mentioned the use of the Microsoft Loopback Connector
    (8)(9)(10)(11). But, this seems most appropriate when the host PC is
    disconnected from all networks, because the Internet Connection Sharing will
    often conflict with other network devices (8). This solution requires
    advanced network administrator knowledge, and is time-consuming to configure.

    * Ignore all older Knowledge Base information on changing the host name
    resolution order (12)(13)(14). As noted above, .NET and IE7 ignore these
    time-honored configuration options.


    1) Microsoft - Internet Explorer Application Compatibility VPC Image for
    Virtual PC 200

    The workaround:

    2) bluecherry - How to run IE6 on Windows Vista using Virtual P

    3) Victor Laurie Computer Education - Using the Windows Hosts File

    4) TCP/IP in Windows 2000 Professional - Configure Hosts Fil

    5) Fiddler - Known Issues / Common problems...

    6) Mindreef - Setting a proxy in Microsoft .NET Framework

    7) Microsoft - BUG: You Cannot Connect to a Proxy on Localhost When You Make
    a Web Request by Using a Loopback Address


    8) Virtual PC Guy's WebLog - Configuring NAT via using the Microsoft
    Loopback Adapter and Internet Connection Sharing

    9) devx - Keep Your Virtual Machines and Hosts Talking Without a TCP/IP

    10) Microsoft - Using Microsoft Loopback Adapte

    11) Microsoft - How to install the Microsoft Loopback adapter in Windows XP

    Ignored localhost remapping for .NET and IE7:

    12) Microsoft TCP/IP Host Name Resolution Order

    13) Microsoft - How to change name resolution order on Windows 95 and
    Windows NT

    14) Microsoft - Windows NT 4.0 ServiceProvider Priority Values Not Applied
    Ken Ismert, Sep 24, 2007
    1. Advertisements

  2. Ken Ismert

    Ken Ismert Guest

    Configuring Apache to use the Machine Name instead of Localhost:

    1. Find or set your machine name. (Start -> Control Panel -> System ->
    Computer Name)
    2. Stop your Apache server
    3. Open your httpd.conf file. (under /hosts in your apache ServerRoot
    directory). Change the following parameters:
    ServerAdmin [email protected]
    ServerName yourmachinename:80
    4. Save httpd.conf, restare Apache
    5. In a browser, go to http://yourmachinename and verify that the default
    Apache web page appears.
    6. If you have existing projects in the DocumentRoot directory (usually
    webroot or www), you may need to find references to localhost as the default
    server, and change them to yourmachinename.

    Determine Your Machine's Local IP Address:

    1. Goto Start -> Run, type cmd, hit enter
    2. Type ipconfig, hit enter.
    3. Write down the IP Address for the Local Area Connection

    Setting up your Virtual PC Instance (WinXP / IE7 or IE6):

    1. Run your Virtual PC Instance
    2. Open the hosts file (under %SystemRoot%\System32\Drivers\Etc)
    3. Add this line ('yourIP' = Local IP address, 'yourmachinename' = machine's
    yourIP yourmachinename
    4. In a browser under the Virtual PC instance, go to http://yourmachinename
    and verify that the default Apache web page appears.
    Ken Ismert, Sep 25, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.