open this file c:\windows\system32\drivers\etc\hosts with the notepad and add the lines
127.0.0.1 localhost
if it is commented (default, line start with ;) then uncomment it.
and try it again.
bad: (ipv6 problem)
C:\Users\Administrator.DEVJC>ping localhost
Pinging DEVJC.vaio.cl [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Ping statistics for ::1:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
good: (ipv6 and ipv4 compatible)
C:\Users\Administrator.DEVJC>ping localhost
Pinging DEVJC.vaio.cl [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
Microsoft says "# localhost name resolution is handled within DNS itself." but it is a lie (an half-lie). Sometimes is true but in a few cases it fail (or it try to resolve externally = slow)