wcf获取客户端IP,端口 var context = OperationContext.Current; var properties = context.IncomingMessageProperties; //获取传进的消息属性 var endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty; //获取消息发送的远程终结点IP和端口 string UserLogin…
http://stackoverflow.com/questions/3937773/wcf-security-using-client-ip-address var context = OperationContext.Current; var props = context.IncomingMessageProperties; var endpoint = props[RemoteEndpointMessageProperty.Name]; return ((RemoteEndpointMe…
public class Service2 : IService2 { public User DoWork() { Console.WriteLine(ClientIpAndPort()); }; } public string ClientIpAndPort() { OperationContext context = OperationContext.Current; MessageProperties properties = context.IncomingMessagePropert…
1.获取客户端IP地址 public String getIp(HttpServletRequest request) throws Exception { String ip = request.getHeader("X-Forwarded-For"); if (ip != null) { if (!ip.isEmpty() && !"unKnown".equalsIgnoreCase(ip)) { int index = ip.indexOf(&…