The grand design is the following:
Pretty straightforward, eh? I used to build this kind of things by the dozen in ye olden days, using roll-my-own UDP-broadcast-based discovery mechanism.
But now I thought I'd be cool and hip, and go with the groovy WCF Discovery in Ad Hoc mode. And it works! Who could tell? :-)
But not quite.
As was noted before me here and there, the discovery returns the hard-coded URL from service's config. That is, if the service has <baseAddresses><add baseAddress="net.tcp://localhost:1234/My/Service" /></baseAddresses>
in it's config file, then that's exactly what I'm going to get from discovery client - including the "localhost" part.
Needless to say, if I try to call the service using that URL, the result is not thrilling.
So the question is: how do I make the discovery client give me the usable URL instead of that localhost-ish garbage?
To save everybody's time, a couple of thoughts that don't work:
In other words, I need not to tweak the service, but rather to make the discovery client give me the address that the discovery response came from.
You should be able to fix this by replacing localhost
with a wildcard:
<baseAddresses><add baseAddress="net.tcp://*:1234/My/Service" /></baseAddresses>
Don't use the config.
Run the service programatically.
Here's an example of adding endpoints programtically: Programmatic_Endpoint_Configuration
And this, for comparison: Self-hosting_and_base_addresses
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With