views:

372

answers:

2

Hi,

I have Vista x64 IIS7 running on my dev. machine.

I used to use Request.ServerVariables.Get("LOCAL_ADDR") to get the operating instance IP address of the website which was resolving into like 192.168.1.89, however after switching to Vista & IIS7, I started to get ::1 which people say that it is IPv6.

How can I get it the old way? We use this to monitor if the instance actually is displaying the correct content. (It is difficult to change that monitoring method)

So golden question is how can I get running web app's Local IP Address?

A: 

Request.ServerVariables.Get("LOCAL_ADDR") will return the IP address of the current web application.

Check the site configuration in IIS and see what IP addresses the site is bound to. If the site is bound to all unassigned IP addresses and you are visiting / debugging the site on the actual server then the ::1(localhost) or 127.0.0.1 address are correct.

Try connect to the site from a different machine, or by specifying the actual IP address rather than the hostname and see if you get a different result.

Colin Cochrane
A: 

By coincidence I find out the solution. It is hidden in the hosts file.

It was written in the hosts file as

127.0.0.1       localhost
::1             localhost

and now I changed it to

127.0.0.1       localhost
#::1             localhost

Works great now.

SevDer