代码
/// <summary>
/// 获取WCF客户端IP
/// </summary>
public static string GetClientIp()
{
    MessageProperties messageProperties 
= OperationContext.Current.IncomingMessageProperties;
    RemoteEndpointMessageProperty endpointProperty 
= 
        messageProperties[RemoteEndpointMessageProperty.Name] 
as RemoteEndpointMessageProperty;
    
if (endpointProperty == null)
        
return string.Empty;
    
else
        
return endpointProperty.Address;
}

 

相关文章:

  • 2021-11-30
  • 2021-10-02
猜你喜欢
  • 2022-12-23
  • 2021-11-06
  • 2021-09-10
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案