Search code examples
asp.netiis-7httpwebrequestvista64

How to get operating IP Address of the WEB instance on IIS7


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?


Solution

  • 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.