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
    127.0.0.1 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.

    Dead-ends:

    * 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.

    References:

    1) Microsoft - Internet Explorer Application Compatibility VPC Image for
    Virtual PC 200
    http://www.microsoft.com/downloads/...90-958F-4B64-B5F1-73D0A413C8EF&displaylang=en

    The workaround:

    2) bluecherry - How to run IE6 on Windows Vista using Virtual P
    http://www.bluecherry.ie/index.php/...to-run-ie6-on-windows-vista-using-virtual-pc/

    3) Victor Laurie Computer Education - Using the Windows Hosts File
    http://vlaurie.com/computers2/Articles/hosts.htm

    4) TCP/IP in Windows 2000 Professional - Configure Hosts Fil
    http://www.microsoft.com/technet/pr...serv/reskit/prork/prcc_tcp_jqlt.mspx?mfr=true

    5) Fiddler - Known Issues / Common problems...
    http://www.fiddler2.com/Fiddler/help/knownissues.asp

    6) Mindreef - Setting a proxy in Microsoft .NET Framework
    http://www.mindreef.com/support/soapscope/4.1/help/proxydetails.html#dotnet

    7) Microsoft - BUG: You Cannot Connect to a Proxy on Localhost When You Make
    a Web Request by Using a Loopback Address
    http://support.microsoft.com/kb/317718

    Dead-ends:

    8) Virtual PC Guy's WebLog - Configuring NAT via using the Microsoft
    Loopback Adapter and Internet Connection Sharing
    http://blogs.msdn.com/virtual_pc_guy/archive/2005/10/04/477195.aspx

    9) devx - Keep Your Virtual Machines and Hosts Talking Without a TCP/IP
    Connection
    http://www.devx.com/enterprise/Article/33644/0/page/1

    10) Microsoft - Using Microsoft Loopback Adapte
    http://www.microsoft.com/technet/pr...ddocs/vs_operate_using_loopback.mspx?mfr=true

    11) Microsoft - How to install the Microsoft Loopback adapter in Windows XP
    http://support.microsoft.com/default.aspx/kb/839013

    Ignored localhost remapping for .NET and IE7:

    12) Microsoft TCP/IP Host Name Resolution Order
    http://support.microsoft.com/kb/172218

    13) Microsoft - How to change name resolution order on Windows 95 and
    Windows NT
    http://support.microsoft.com/kb/139270/EN-US/

    14) Microsoft - Windows NT 4.0 ServiceProvider Priority Values Not Applied
    http://support.microsoft.com/kb/171567/EN-US/
     
    Ken Ismert, Sep 24, 2007
    #1
    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
    name):
    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
    #2
    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.