WCF 发现:EndpointNotFoundException,即使找到端点

发布于 2024-10-01 22:26:30 字数 638 浏览 0 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吖咩 2024-10-08 22:26:30

至少在我的例子中,错误是由于错误的绑定造成的 - 它的 SecurityMode 设置不正确。

At least in my case the error was due to a wrong binding - its SecurityMode was not set correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文