在WCF服务C#中的服务器端获取客户端的Mac地址 [英] Get Client's Mac address at server side in WCF service C#\
问题描述
我将WCF服务托管为Windows服务,我试图在服务器端(WCF端)获取客户端(WPF客户端)Mac地址.我尝试使用以下代码行,但它也以:: 1格式提供了我的客户端IP地址. RemoteEndpointMessageProperty属性= OperationContext.Current.IncomingMessageProperties [RemoteEndpointMessageProperty.Name]作为RemoteEndpointMessageProperty;
I have WCF service hosted as windows service, I am trying to get clients (WPF client) Mac address at server end (WCF side). I have tried using following line of code but it gives me IP address of client that too in ::1 format. RemoteEndpointMessageProperty prop = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
属性地址为:: 1
如何获取客户端 Mac地址 ,以便我可以区分使用我的服务的客户端.在某些情况下,同一网络下的客户端可能会给我相同的IP地址,这就是我正在寻找 Mac地址来标识客户端呼叫的原因.
How can I get client Mac address so that I can differentiate among the client hitting my service. There could be scenarios where clients under same network may give me same IP address and that is reason I am looking for Mac address to identity client's call.
推荐答案
快速问题:您是否可以使用/修改WPF代码?
Quick question: are you able to work with/modify the WPF code?
我的想法是,您可以让WPF客户端在初始化时生成唯一的代码,并将其连同对服务器的每个请求一起包含在内.
My thought is you could have the WPF client generate a unique code upon initialization, and include that along with each of its requests to the server.
这篇关于在WCF服务C#中的服务器端获取客户端的Mac地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!