【发布时间】:2018-03-18 23:20:26
【问题描述】:
这是我正在处理的项目中的代码的 sn-p,它让多个客户端连接到 WCF 服务(主机),主机用于检测对服务库数据库所做的任何更改并显示给每个客户端所做的更改,它显示更改的值,进行更改的客户端的 IP 地址。
private void RaisedPropertyChanged(string prop)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(prop));
}
public string GetIP()
{
OperationContext context = OperationContext.Current;
MessageProperties prop = context.IncomingMessageProperties;
RemoteEndpointMessageProperty endpoint =
prop[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
string ip = endpoint.Address;
Console.WriteLine("Client Ip" + ip);
return ip;
}
【问题讨论】:
-
你的代码现在做什么?你想让它做什么呢?
-
它不会向其他连接的客户端显示客户端信息(已更改的值),而是继续解决问题。
标签: c# wcf wcf-binding