Share via


How to Figure Out Which IP Address a WCF Client Request Comes in From

**
**

Problem

You are looking for the client IP address that a WCF request comes in from

Solution

You can take advantage of RemoteEndpointMessageProperty 

You can get access to the property from a service method like below (property may be null if your binding does not support capturing the remote address):

RemoteEndpointMessageProperty endpoint =
OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessagePr
operty.Name] as  RemoteEndpointMessageProperty;