Search code examples
wcfc#-4.0wcf-binding

How to implement publish/subscribe communication over cross machine


I have a .Net service hosted on a server windows 2008, and .Net clients connecting to this server over the internet.

I want to implement a publish subscribe model same Microsoft sample using wsDualHttpBinding where clients can subscribe to events on the service and have data pushed to them as data becomes available.

I have implemented service on server and able to browse successfully. But when i try to communicate from client it will end up with timeout(I have increased the time property on config file on both file client and server)

Client config file:

<client>
  <endpoint name="" address="http://x.x.x.x/servicemodelsamples/service.svc" binding="wsDualHttpBinding" bindingConfiguration="Binding1" contract="Microsoft.ServiceModel.Samples.ISampleContract"/>
</client>

<bindings>
  <wsDualHttpBinding>
    <!--If running in cross machine then replace localhost with the FQDN of the machine on whihc datasource.exe is run-->
    <binding name="Binding1" clientBaseAddress="http://xxxx:xxxx/myClient/" closeTimeout="00:05:00"
        openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
        bypassProxyOnLocal="false" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"
        useDefaultWebProxy="true">
      <security mode="None">
        <message clientCredentialType="None" negotiateServiceCredential="false" />
      </security>

    </binding>
  </wsDualHttpBinding>
</bindings>


Solution

  • WSDualHttpBinding doesn't work for normal clients over the internet.

    This answer explains why: Connecting over internet to WCF service using wsDualHttpBinding times out

    Since your clients are .NET, you should be able to use a duplex NetTcpBinding