简体   繁体   中英

How to know the IIS server ip for my website access

I have deployed a website in my server, how i know which what my server IP is ?

if i know my server ip , i could access my website from outside

If you know your hostname you can use nslookup to get the ip adress. Alternatively you can find all the ip adresses on the network cards using ipconfig . So either:

nslookup hostname

Or

ipconfig /all

You could also use netstat -n to find the ip adress listening on port 80 (which is the default for http)

First, check with the IIS Console. Right click web site + properties. The tab named "Web Site" shows the "IP Address". This btw could be "All unassigned", so you'd have to do an ipconfig on the server, and deduct IPs explicitly used by other web sites.

Second, beware that this address could be mapped to some other [public] address at the level of a firewall / gateway / WSD device on between the server and the client.

Third (or first), using "ping" or "nslookup" as indicated in other replies, ensure that the name that will be used as part of the url matches the IP discovered above.

Simple way is to ping your hostname. Eg,

ping microsoft.com

Note you'll need to do this from outside your server's netork, as you may get an internal private IP otherwise.

The IP of the server is the same IP as the host (machine) where it is located, if the server is in your LAN.

You will be able to access your website from outside if your proxys allows it.

I don't really understand what you are talking about saying "my server" .

尝试ping servername和/或ping url

Do it in the code..

Request.ServerVariables("LOCAL_ADDR")

OR

String name = "";
name = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostByName(name);
foreach (IPAddress ipaddress in ipEntry.AddressList)
{
    Response.Write("IP : " + ipaddress.ToString());
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM