I use the following code snippet to get client ip on wcf service:
OperationContext context = OperationContext.Current;
System.ServiceModel.Channels.MessageProperties prop = context.IncomingMessageProperties;
System.ServiceModel.Channels.RemoteEndpointMessageProperty endpoint = prop[System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name] as System.ServiceModel.Channels.RemoteEndpointMessageProperty;
string ip = endpoint.Address;
while this code worked on iis6 / server2003, everything was fine, endpoint.Address returned ipv4. but after I recently upgraded to the iis7 / server2008 endpoint. Add returns ipv6.
is it possible to get ipv4 on iis7 / server2008?
Thank!
source
share