I’m watching a webcast on WCF, and it has two endpoints defined in the app.config, one netTcpBinding and one mexHttpBinding.
It also has two base addresses, net.tcp://localhost:9000 and http://localhost:8000.
I’m wondering how it associates those base addresses with the endpoints. Since your endpoint specifies tcp or http, why are the base addresses prefixed with net.tcp and http?
If WCF uses net.tcp base addresses with netTcpBinding endpoints, what happens if you have two tcp endpoints that listen on 9000 and 9001, what would you put into the config to stop the conflict?
Per protocol.
When you define service endpoints, you can give relative or absolute addresses for the endpoints, if you give an absolute endpoint address then the base addresses will not be used to generated the actual endpoint address, however if you give a relative address
in your endpoint then a combination of your base address and relative address will be used to generated the final endpoint address.
A relative endpoint address is like this for example:
Now WCF will generate the actual endpoint address using your base address that you defined per protocol:
So your HTTP endpoint address will ultimately be:
and your netTcp endpoint:
Now if you have another protocol defined, and you haven’t defined an absolute address in your endpoint, WCF will look for the base address defined for that particular protocol, and generate an endpoint using the base address.
I think it would be best to give absolute adresses in ypour endpoints in this instance:
As mentioned previously when you provide absolute addresses then your base addresses won’t be consulted in generating an endpoint address.
You may want to have a look at this.