首页 文章

WCF发现:EndpointNotFoundException,即使找到了 endpoints

提问于
浏览
2

我正在使用WS Discovery动态查找并连接到本地网络上的 endpoints .

var cli = new DiscoveryClient (new UdpDiscoveryEndpoint ());
var response = cli.Find (new FindCriteria (typeof (IFoo)));

返回 net.tcp://localhost:8000/ ,这是正确的 . 但

var ep = new DynamicEndpoint (
    ContractDescription.GetContract (typeof (IFoo)), new NetTcpBinding ());
var cf = new ChannelFactory<IFoo> (ep);
var ch = cf.CreateChannel ();
ch.SomeMethod ();

使用以下消息抛出EndpointNotFoundException:

“发现了1个 endpoints ,但客户端无法使用任何已发现的 endpoints 创建或打开该通道 . ”

我搜索了错误消息,但没有结果!发生了什么,我该如何解决这个问题?

1 回答

  • 0

    至少在我的情况下,错误是由于错误的绑定 - 其SecurityMode未正确设置 .

相关问题