Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat to use as WCF net.tcp host baseAddress on different servers?
    primarykey
    data
    text
    <p>In my App.config, i have this base address specified ("jerrycan" is the name of my computer):</p> <pre class="lang-xml prettyprint-override"><code>&lt;service behaviorConfiguration="helloWorldServiceBehavior" name="OpdService.OpdService"&gt; &lt;endpoint address="/service" binding="netTcpBinding" bindingConfiguration="NewBinding0" name="MainEndPoint" contract="OpdService.IOpdService"&gt; &lt;identity&gt; &lt;dns value="jerrycan" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint kind="udpDiscoveryEndpoint" /&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="net.tcp://jerrycan:8000" /&gt; &lt;add baseAddress="http://jerrycan/service" /&gt; &lt;/baseAddresses&gt; &lt;timeouts openTimeout="00:00:15" /&gt; &lt;/host&gt; &lt;/service&gt; </code></pre> <p>Everything works fine until I run service on other computer — clients can find service through UDP discovery, but aren't able to connect, as service continues to send old address. When I change "jerrycan" to "localhost", only local clients are able to connect to service (but on any computer). Any clients on other computers try to connect to "localhost" with no success.</p> <p>So what should I use as host address if I want to be able to run service on different computers without recompile? Should I store address somewhere in config file for every computer, or should I change address in runtime? I think, I'm missing something simple and fundamental here.</p> <p>Or maybe I should use localhost (as in many wcf samples) and it's my client connection code who brings the problems:</p> <pre class="lang-cs prettyprint-override"><code>EndpointAddress endpointAddress = findResponse.Endpoints[0].Address; OpdChannelFactory = new DuplexChannelFactory&lt;OpdServiceReference.IOpdService&gt;(CallbackHandler, new NetTcpBinding("MainEndPoint"), endpointAddress); </code></pre> <p>Again, when I use "localhost" as base address, "localhost" comes as endpoint address in <code>findResponse</code>.</p> <p><strong>Edit:</strong> </p> <p>It seems like <strong>I found solution</strong> here: <a href="http://btw-blog.blogspot.com/2011/02/dynamic-base-address-for-wcf-service.html" rel="nofollow">http://btw-blog.blogspot.com/2011/02/dynamic-base-address-for-wcf-service.html</a></p> <p>The point is to replace host name in base address with * symbol (wildcard). It will be changed with actual host name in run time.</p> <p>Haven't tested everything yet, but looks like it actually works.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload