[英]Get client IP address in a WCF Service hosted using HTTPS 443 bindings
在我的一个需要的应用程序中,使用HTTPS 443绑定托管的WCF服务中的客户端IP地址。
我尝试了堆栈溢出和其他网站关于这个问题的大部分帖子但是当我在服务器中托管我的应用程序时它只是获取服务器IP地址但我需要客户端地址任何有任何想法
提前致谢..
在.NET 3.5中,您可以使用以下模式(使用System.ServiceModel
)
OperationContext context = OperationContext.Current;
MessageProperties prop = context.IncomingMessageProperties;
RemoteEndpointMessageProperty endpoint = prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
string ip = endpoint.Address;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.