简体   繁体   English

如何知道我的网站访问的IIS服务器IP

[英]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 ? 我在我的服务器中部署了一个网站,我怎么知道我的服务器IP是什么?

if i know my server ip , i could access my website from outside 如果我知道我的服务器IP,我可以从外面访问我的网站

If you know your hostname you can use nslookup to get the ip adress. 如果您知道主机名,则可以使用nslookup来获取ip地址。 Alternatively you can find all the ip adresses on the network cards using ipconfig . 或者,您可以使用ipconfig找到网卡上的所有IP地址。 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) 您还可以使用netstat -n查找端口80上的ip地址(这是http的默认设置)

First, check with the IIS Console. 首先,使用IIS控制台进行检查。 Right click web site + properties. 右键单击网站+属性。 The tab named "Web Site" shows the "IP Address". 名为“网站”的选项卡显示“IP地址”。 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. 这个btw可能是“全部未分配”,因此您必须在服务器上执行ipconfig,并扣除其他网站明确使用的IP。

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. 其次,请注意该地址可以映射到服务器和客户端之间的防火墙/网关/ WSD设备级别的某个其他[公共]地址。

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. 第三(或第一),使用其他回复中指出的“ping”或“nslookup”,确保将用作URL的一部分的名称与上面发现的IP匹配。

Simple way is to ping your hostname. 简单的方法是ping你的主机名。 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. 请注意,您需要从服务器的netork外部执行此操作,否则您可能会获得内部私有IP。

The IP of the server is the same IP as the host (machine) where it is located, if the server is in your LAN. 如果服务器在您的LAN中,则服务器的IP与其所在的主机(机器)的IP相同。

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());
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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