2

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?

Matthew Steeples
  • 7,858
  • 4
  • 34
  • 49
timothymcgrath
  • 1,318
  • 1
  • 9
  • 19

1 Answers1

2

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.

RMD
  • 3,421
  • 7
  • 39
  • 85