Ping Localhost Returns Invalid IP

G

Guest

I'm having trouble testing an ASP.net app on IIS7. In my application I'm
testing the IP address of the host and acting on it. This test fails on Vista
because the system is returning an invalid IP address for localhost. All 3 of
the following commands return ::1 rather then 127.0.0.1
Ping localhost
HttpContext.Current.Request.UserHostAddress
HttpContext.Current.Request.ServerVariables("REMOTE_ADDR")
I've turned off ipv6 thinking this might have been the trouble but it still
returns the same data. I can ping 127.0.0.1 and that works but by name
localhost and via the ASP.net request object is invalid.
 
G

Guest

I think this may be because the LMHOST.SAM file that installs with Vista does
not have the last entry "remarked out" and thus it actually loads the 127
address for localhost.
 
G

Guest

Actually I found the problem. It was actually in the hosts file rather then
lmhost.sam. There was a double entry in it for 127.0.0.1.
127.0.0.1 localhost
::1 localhost

This was in a clean file from a clean install. I am reasonably sure it was
there from the time I loaded RC1. Since I'm evaluating the basic environment,
I have not loaded anything other than MS apps - Office 2007 and VS2005

Michael
 
G

Guest

Thanks for the reply. The trouble was not in LMHOST.SAM but in HOSTS.
There was a double entry for localhost:
127.0.0.1 localhost
::1 localhost

The load of VistaRC1 was a clean install on a fresh partition. Only MS apps
have been loaded - Office 2007 and VS2005.
 
G

Guest

I found the same entries in my hosts / lmhosts.sam files from a fresh install
of Vista RC1. Ihave tried to edit them using notepad but get an error
message that I can't save to the ...etc directory. I can rename and delete
but can't seem to save anything into that directory. I think I have
everything set to be fully priviledged but no luck updating my hosts &
lmhosts - any ideas / did you have this problem?
 
P

Peter Thomas

RobertLane said:
I think this may be because the LMHOST.SAM file that installs with Vista does
not have the last entry "remarked out" and thus it actually loads the 127
address for localhost.

I think you will find that the ::1 is actually an entry for the IPV6
localhost address...

I'm not able to play with my Vista right now, but do you have IPv6
enabled on that machine?

Peter
 
G

Guest

Regarding saving the file to the etc folder... no trouble there. The machine
is part of my development domain and I was logged in with the domain admin
account so I had full permission.

Regarding IPv6, that is enabled by default but I have nothing that uses it
so I disabled it. I suspected it was part of the support for it but have not
found any documentation to back it up yet.

If anyone knows where this is documented, please post it here. This was the
1st case I've run into where my software broke because of IPv6 so it would
help to know what else to expect as adoption of IPv6 at some point is a given.
 
P

Peter Thomas

I tried a few quick things last night

By default I DO have IPv6 enabled.

ping localhost

sure enough; this used by default IPv6

ping -4 localhost

This now uses IPv4.

Peter
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top