سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top