| Next: Ping Localhost Returns Invalid IP |
| Author |
Message |
Leightynet External

Since: Oct 02, 2006 Posts: 5
|
Posted: Mon Oct 02, 2006 9:52 am Post subject: Ping Localhost Returns Invalid IP Archived from groups: microsoft>public>windows>vista>networking_sharing (more info?) |
|
|
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. |
|
| Back to top |
|
 |
RobertLane External

Since: Oct 03, 2006 Posts: 15
|
Posted: Tue Oct 03, 2006 7:50 pm Post subject: RE: Ping Localhost Returns Invalid IP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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.
"Leightynet" wrote:
> 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. |
|
| Back to top |
|
 |
Leightynet External

Since: Oct 02, 2006 Posts: 5
|
Posted: Tue Oct 03, 2006 9:36 pm Post subject: RE: Ping Localhost Returns Invalid IP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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
"RobertLane" wrote:
> 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.
>
> "Leightynet" wrote:
>
> > 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. |
|
| Back to top |
|
 |
Leightynet External

Since: Oct 02, 2006 Posts: 5
|
Posted: Tue Oct 03, 2006 9:39 pm Post subject: RE: Ping Localhost Returns Invalid IP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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.
"RobertLane" wrote:
> 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.
>
> "Leightynet" wrote:
>
> > 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. |
|
| Back to top |
|
 |
RobertLane External

Since: Oct 03, 2006 Posts: 15
|
Posted: Wed Oct 04, 2006 5:35 am Post subject: RE: Ping Localhost Returns Invalid IP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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?
"Leightynet" wrote:
> 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
>
> "RobertLane" wrote:
>
> > 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.
> >
> > "Leightynet" wrote:
> >
> > > 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. |
|
| Back to top |
|
 |
Peter Thomas External

Since: Oct 04, 2006 Posts: 2
|
Posted: Wed Oct 04, 2006 10:06 am Post subject: Re: Ping Localhost Returns Invalid IP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
RobertLane wrote:
> 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.
>
> "Leightynet" wrote:
>
>> 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.
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 |
|
| Back to top |
|
 |
Leightynet External

Since: Oct 02, 2006 Posts: 5
|
Posted: Wed Oct 04, 2006 10:06 am Post subject: Re: Ping Localhost Returns Invalid IP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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.
"Peter Thomas" wrote:
> RobertLane wrote:
> > 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.
> >
> > "Leightynet" wrote:
> >
> >> 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.
>
> 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
> |
|
| Back to top |
|
 |
Peter Thomas External

Since: Oct 04, 2006 Posts: 2
|
Posted: Thu Oct 05, 2006 10:52 am Post subject: Re: Ping Localhost Returns Invalid IP [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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 |
|
| Back to top |
|
 |
|