简体   繁体   中英

Automatically set port number at client side while using wcf duplex binding

I have implemented wcf service with duplex binding and it is working fine. What I have done at client side is I have configured ClientBaseAddress in config file. Default port ie 80 which I want my application to automatically use available port.

So my question, is there any way where I can automatically set the available free port?

I'm not totally clear on what you are asking but as indicated in this answer, you can set the port to '0' and this will cause WCF to pick the next available free port. However, this seems to be a random port and not necessarily port 80. It's unclear to me whether you specifically want port 80.

Using this method will cause a problem on your client. They will not know which port to talk over. There is a feature in WCF called WCF Discovery in which a client 'discovers' the location of the service over a network.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM