Resolve localhost on 64-bit OS

Problem

When “localhost” is used for the URL e.g “http:\\localhost:9813” for either Web Service Client or XML over http, NLINK fails to resolve “localhost” properly. If the same is replaced with the IP address (say) “http:\\10.1.1.123:9813”, then it works.

Solution

Problem may have to do with IPv6 being used on Windows Server 2008. There are ways to get localhost to be resolved properly, but some of these options may affect IPv6 enabled applications.

Junot Systems does not recommend any of these solutions but they are documented here for your information only.

  1. Edit the hosts file (it’s hidden under Windows Server 2008, (Start->Run->notepad SYSTEMROOT\System32\Drivers\etc\hosts) and change the mapping for localhost from “::1 localhost” to “127.0.0.1 localhost”.
  2. Set the TCP stack to prefer IPv4 to IPv6 when attempting to connect (it’s the reverse by default). This entails setting the registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tcpip6\Parameters\DisabledComponents to the DWORD value 0×20.
  3. Disable IPv6 altogether for your network connection: remove the IPv6 protocol from your network connection component list.