Reputation: 80805
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.
Upvotes: 10
Views: 1598
Reputation: 1362
Another option other than wildcard is to use the machine's DNS-resolvable hostname instad of localhost.
Upvotes: 0
Reputation: 20850
You should be able to fix this by replacing localhost
with a wildcard:
<baseAddresses><add baseAddress="net.tcp://*:1234/My/Service" /></baseAddresses>
Upvotes: 13
Reputation: 49261
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
Upvotes: 3