在使用HTTPS 443绑定托管的WCF服务中获取客户端IP地址 [英] Get client IP address in a WCF Service hosted using HTTPS 443 bindings
本文介绍了在使用HTTPS 443绑定托管的WCF服务中获取客户端IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的一个需要的应用程序中,使用HTTPS 443绑定托管的WCF服务中的客户端IP地址。
In one of my application in need client IP address in a WCF Service hosted using HTTPS 443 bindings.
我尝试了大部分的堆栈溢出和其他帖子有关此问题的网站,但当我在服务器中托管我的应用程序时,它只是获取服务器IP地址,但我需要客户端地址任何有任何关于此的想法
and i tried most of the post of stack overflow and other site regarding this issue but when i hosted my application in server it just fetch server IP address but i need requested client address any have any idea regarding this
在此先感谢..
推荐答案
在.NET 3.5中,您可以使用以下模式(使用 System.ServiceModel
)
In .NET 3.5 you can do using the below pattern (using System.ServiceModel
)
OperationContext context = OperationContext.Current;
MessageProperties prop = context.IncomingMessageProperties;
RemoteEndpointMessageProperty endpoint = prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
string ip = endpoint.Address;
这篇关于在使用HTTPS 443绑定托管的WCF服务中获取客户端IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文