public static IPAddress GetIpAddress(System.ServiceModel.OperationContext context)
{
#if !MONO
var prop = context.IncomingMessageProperties;
if (context.IncomingMessageProperties.ContainsKey(System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name))
{
var endpoint = prop[System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name]
as System.ServiceModel.Channels.RemoteEndpointMessageProperty;
if (endpoint != null)
{
return IPAddress.Parse(endpoint.Address);
}
}
#endif
return null;
}