title: Seeking WCF Duplex "TwoWay" Subscribe+Callback Example
body: <p><strong>Renewing the bounty AGAIN because I really need to know how to get this to work, or a definitive answer about why it won't.</strong></p>
  
  <p><strong><a href="https://stackoverflow.com/questions/3713686/wcf-server-to-client-callback-method-with-return-value">I've added an alternative explanation of the problem here.</a></strong></p>
  
  <p>Having a hell of a time getting a two-way (IsOneWay = false) WCF client-server to work in .Net 3/3.5.</p>
  
  <p>After the client successfully enrolls with the service, the service's periodic Announcement() calls-back to the enrolled clients.  It is now that either the client or the server hangs until the server's SendTimeout, adjusted to 2 seconds, elapses.  Then the server side has a timeout exception as follows.  Only then does the client user code immediately RECEIVE THE METHOD CALL and attempt to return a value.  By then the client's socket is aborted and the WCF stuff fails.  </p>
  
  <p>It seems to me that something on the client is hanging it's local WCF queue from processing until the socket times out, but not quite early enough to cancel the local method call.  But if the exception below is to be believed, the server is attempting to send an operation to <a href="http://schemas.microsoft.com/2005/12/ServiceModel/Addressing/Anonymous" rel="nofollow noreferrer">http://schemas.microsoft.com/2005/12/ServiceModel/Addressing/Anonymous</a> (inappropriate!) and is timing out.  Maybe that URI is just the "Name" of the remotely connected client as WCF knows to refer to it for the purposes of the error message and it just appears to mean that it's failing to load a URI.  I can't tell if the server fails first or the client fails first.</p>
  
  <p>I've tried adding WCF tracing but I'm not getting much more information.</p>
  
  <p><strong><a href="https://stackoverflow.com/questions/3392123/wcf-duplex-callback-sample-failing">Similar sample code is here</a></strong>, but it must have been too much to digest.  I've experimented with varations of that code.</p>
  
  <pre><code>TimeoutException 'This request operation sent to http://schemas.microsoft.com/2005/12/ServiceModel/Addressing/Anonymous did not receive a reply within the configured timeout (00:00:00).  The time allotted to this operation may have been a portion of a longer timeout.  This may be because the service is still processing the operation or because the service was unable to send a reply message.  Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client.'
  
  Server stack trace: 
     at System.ServiceModel.Dispatcher.DuplexChannelBinder.SyncDuplexRequest.WaitForReply(TimeSpan timeout)
     at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
  </code></pre>