0

I am trying to find my servers with the help of WCF Discovery protocol. Everything is nice when I specify explicit address for server, for example: net.tcp://192.168.36.18:8888. But when I specify net.tcp://0.0.0.0:8888 address on the server to listen all interfaces I receive net.tcp://0.0.0.0:8888 on the client. Certainly, I can't use this address to connect to the server. Physically responce for wcf discovery request is coming from real servers addresses: 192.168.36.100, 192.168.36.239 and 192.168.36.61. I can see it by Wireshark. But I can't get this adresses from FindResponce class.

Is there a way to get physical address if server was configured to listen all interfaces by WCF discovery?

Code on the client:

var discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());
var findResponce = discoveryClient.Find(new FindCriteria(typeof(IRadioService)));
discoveryClient.Close();

Code on the server:

var serviceHost = new ServiceHost(new RadioServer());
serviceHost.Open();

Config on the server:

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="RadioServer">
          <serviceDiscovery />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="RadioServer" name="Server.RadioServer">
        <endpoint address="RS" binding="netTcpBinding" contract="Common.IRadioService" />       
        <endpoint name="udpDiscovery" kind="udpDiscoveryEndpoint" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://0.0.0.0:8888/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
Bevz Oleg
  • 61
  • 8
  • For anyone looking for an answer to this problem, you can look at [my solution](http://stackoverflow.com/a/28360013/161250), which I've posted as an answer on a different SO question. – Alex Feb 06 '15 at 12:21
  • Alex, thank you! That really helps! I thought nobody on stackoverflow can answer this question. – Bevz Oleg Feb 09 '15 at 04:06
  • Yeah, it was quite difficult. It took me several days of research to come up with that solution. I was determined to figure it out. I'm glad my solution is helpful. – Alex Feb 09 '15 at 05:58

0 Answers0