问题描述
|
我希望服务器使用WCF发现不断跟踪可用的客户端。
public void Start()
{
findCriteria = new FindCriteria(typeof(ITestRunnerAgent))
{
Scopes = {new Uri(scope)},Duration = TimeSpan.FromMilliseconds(DiscoveryIntervalInMiliseconds)
};
discoveryClient = GetInitilizedDisoveryClient();
discoveryClient.FindAsync(findCriteria);
}
private DiscoveryClient GetInitilizedDisoveryClient()
{
var client = new DiscoveryClient(new UdpDiscoveryEndpoint());
client.FindProgressChanged += OnFindProgressChanged;
client.FindCompleted += OnFindCompleted;
return client;
}
private void OnFindCompleted(object sender,FindCompletedEventArgs e)
{
if (!e.Cancelled)
{
// HERE! Sometimes e.Error is not null,but as described in question
discoveryClient.FindAsync(findCriteria);
}
}
不幸的是,有时在注释指定的位置,我得到了一个异常终止的Udp通道:
通讯对象,
System.ServiceModel.Channels.UdpChannelFactory + ClientUdpDuplexChannel,
不能用于通讯
因为它已经中止了。
有谁知道为什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)