Search code examples
c#.netwcfipwcf-binding

The client IP address format in a WCF service


I'm using the latest WCF version. I'm getting the client's IP address like that:

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

The IP I get is:

::1

What does it mean, can someone explain me this format?

Is it because of the binding? I use basicHttpBinding


Solution

  • That is the IPv6 loopback address

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

    i.e. The client is on the same machine and is connecting to the service using IPv6