I have endpoints defined in a config file with a "fake" domain name. The idea being that this would make deployment easier, since instead of modifying the config files, we simply set the ip address of the "fake" domain name on the enviroments' hosts files. So for example, on my local dev box, I would have an entry in the hosts file
127.0.0.1 fake.domain
and on a user acceptance environment I might have
192.45.34.31 fake.domain
but in my config file I would just have the endpoint
<endpoint address="http://fake.domain/someServiceBase/SomeService.svc" ... />
However, WCF seems to completely ignore the hosts file. I can copy past the address into a browser, and it will come right up, but the WCF client (which is on the local dev box) will give a "host not found" error.
Why does WCF ignore the hosts file?
Edit: Additional note, everything works if I replace the endpoint address to use the actual ip address directly in the config file, e.g.
<endpoint address="http://127.0.0.1/someServiceBase/SomeService.svc" ... />
Why does WCF ignore the hosts file?
Hmm, I suspect that it isn't. I'd guess that your client is making a connection, but being redirected by the service.
There's an article here that goes into great detail on endpoints:
The Windows Communication Foundation channel infrastructure revolves around the physical address since it’s responsible for receiving incoming messages using a particular transport protocol at a specific location. The Windows Communication Foundation dispatcher, on the other hand, is shielded from such networking details and instead focuses on mapping the incoming message to an endpoint, and ultimately to a method call.
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