WCF 发现:EndpointNotFoundException,即使找到端点
我正在使用 WS Discovery 动态查找并连接到本地网络上的端点。
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 个端点,但客户端无法创建或打开与任何已发现端点的通道。”
我用谷歌搜索错误消息,但没有结果!发生了什么事,我该如何解决这个问题?
I'm using WS Discovery to dynamically find and connect to endpoints on the local network.
var cli = new DiscoveryClient (new UdpDiscoveryEndpoint ());
var response = cli.Find (new FindCriteria (typeof (IFoo)));
returns net.tcp://localhost:8000/
, which is correct. But
var ep = new DynamicEndpoint (
ContractDescription.GetContract (typeof (IFoo)), new NetTcpBinding ());
var cf = new ChannelFactory<IFoo> (ep);
var ch = cf.CreateChannel ();
ch.SomeMethod ();
throws an EndpointNotFoundException with this message:
"1 endpoint(s) were discovered, but the client could not create or open the channel with any of the discovered endpoints."
I googled for the error message but there were no results! What is happening, and how can I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
至少在我的例子中,错误是由于错误的绑定造成的 - 它的 SecurityMode 设置不正确。
At least in my case the error was due to a wrong binding - its SecurityMode was not set correctly.