//提供方法执行的上下文环境 OperationContext context = OperationContext.Current; //获取传进的消息属性 MessageProperties properties = context.IncomingMessageProperties; //获取消息发送的远程终结点IP和端口 RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; Logger.WriteLog("请求来直哪里:" + endpoint.Address);