Click here to Skip to main content
16,012,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.
I’m working on a WCF project where I done an app.config file. In that file I let WCF service choose the port. The Endpoint Address is also defined in app.config file. Now I need to grab that port number code for further processing in a class.

Howe do I grab that port number by code?
Best to you.
Posted
Comments
dan!sh 17-Apr-11 1:16am    
Is this client side configuration you are talking about? And the port number is part of endpoint address, right?
pluss400 17-Apr-11 6:43am    
Hi. Thanks for answering.
The port is generated automatic by WCF in app.config by setting the bindings/binding/…port = ”0”. Now I need this same port when I register into a cloud so my WCF Endpoint has the same port nr as my Socket Endpoint in my PeerName.
I know I can do everything in C# code and seriously thinking doing it that way. Way I want to use config file is to be able to do an easy update later on.
Any suggestions are appreciated.
I´m just curious. Are you Danish because I’m Swedish.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900