Now if you are deploying your service to many machines you must either adjust the host name for each machine during/after the installation or you set the host name to 'localhost'. The problem with the last option is that if you are also exposing metadata then the MEX client will get some endpoint addresses with 'localhost' as host name and will try to call this service on its local machine unless you adjust the host name while creating a proxy.
A handy solution for this problem is to use a so called 'weak wildcard' for the host name part of the base address:
<system.serviceModel> <services> <host> <baseAddresses> <add baseaddress="net.tcp://*:1234/svc" /> </baseAddresses> </host> </services> </system.serviceModel>That's it. The framework will replace the wild card with the name of the host the service is actually running on.
Edit: The solution works only with base-addresses not with endpoint addresses!
7 comments:
Your XML is wrong. Should look like this:
Thank your for the comment! I guess you talk about the baseAddresses tag. Was a typo :) I've updated the post.
brilliant! thanks!
Thank you very much, that saved me
Took me a while to find this! You are amazing. I wish your children and your children's children the ability to lure women to their bedside with no more than the blink of an eye.
Can we use the same if we want to expose the service via public fqdn on https?
Reallly,,, workk... thanks you so much..
Post a Comment