WCF 服务中的客户端 IP 地址格式

The client IP address format in a WCF service

我使用的是最新的 WCF 版本。我正在这样获取客户端的 IP 地址:

        OperationContext context = OperationContext.Current;
        MessageProperties prop = context.IncomingMessageProperties;
        RemoteEndpointMessageProperty endpoint = prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
        string ip = endpoint.Address;

我得到的IP是:

::1

这是什么意思,谁能给我解释一下这种格式?

是绑定的原因吗?我用 basicHttpBinding

也就是IPv6环回地址

https://en.wikipedia.org/wiki/Localhost

即客户端在同一台机器上并使用 IPv6

连接到服务