我应该为我的 WCF P2P 应用程序分配一个端口吗?

发布于 2024-10-08 19:56:05 字数 89 浏览 1 评论 0原文

我正在使用 PNRP 功能构建 WCF P2P 服务。

我发现我可以为绑定分配端口...但大多数示例都不能。 我是否有理由应该或不应该给它一个端口?

I'm building a WCF P2P service using the PNRP functionality.

I see that I can assign a port to the Bindings... but most of the examples do not.
Is there a reason I should or shouldn't give it a port?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

┊风居住的梦幻卍 2024-10-15 19:56:05

如果您不分配端口,WCF 将自动选择一个随机可用端口。作为 PNRP 过程的一部分,本地端口信息会广播给对等点,因此显式设置本地端口比其他任何事情都更能让您的应用程序变得可预测。

我通常明确设置我的端口,以便我可以将它们记录给我的客户。当客户使用我无法在代码中轻松配置的第三方防火墙时,这一点尤其重要。如果您的应用程序分配了随机端口,他们将不知道要在防火墙软件中解锁哪个端口。

If you don't assign a port, WCF will choose a random available port automatically. The local port information is broadcast to peers as part of the PNRP process, so setting a local port explicitly is more to make your application predictable than anything else.

I usually set my ports explicitly so that I can document them to my customers. This is especially important when a customer uses a 3rd party firewall that I can't easily configure in code. If your app assigns a random port, they won't know what port to unblock in their firewall software.

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