1

I have tried to implement WCF callback using WSDualHttpBinding. The service is hosted on IIS 7.

When I created a sample client for the service on the same machine as the host, it works fine. But when I ran the same client from a different system on the network I get timeout exception

Server stack trace:at System.ServiceModel.Channels.ReliableRequestor.ThrowTimeoutException()at System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout)at System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout)at System.ServiceModel.Channels.ClientReliableDuplexSessionChannel.OnOpen(TimeSpan timeout)at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

The CallbackContract look as follows:

 public interface IMyServiceCallBack
    {
        [OperationContract(IsOneWay = true)]
        void Notify();
}

I have also specified

[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession,ConcurrencyMode = ConcurrencyMode.Reentrant)]

The app.config on Client is as follows:

 <wsDualHttpBinding>
            <binding name="WSDualHttpBinding_Callback" closeTimeout="00:01:00"                         clientBaseAddress="http://10.1.3.199:8002/myServiceHost/myService.svc/Endpoint"
                     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                     bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                     maxBufferPoolSize="97108864" maxReceivedMessageSize="97108864"
                     messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
              <readerQuotas maxDepth="32" maxStringContentLength="97108864" maxArrayLength="97108864"
                  maxBytesPerRead="97108864" maxNameTableCharCount="97108864" />              
              <security mode="None"/>
            </binding>
          </wsDualHttpBinding>
<client>
 <endpoint address="http://10.1.3.199/myServiceHost/myService.svc/Endpoint"
                binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_Callback"
                contract="myService.ServiceContract" name="WSDualHttpBinding_Callback" />
</client>

What am I MISSING!!!

xaria
  • 842
  • 5
  • 24
  • 47

1 Answers1

2

WSDualHttpBinding will only work if both port 80 is reachable by the server and the client. Yes, that means the server will attempt to open a TCP connection back to your client. Over the internet WSDualHttpBinding is basically useless as most users sit behind routers which do not route the connection back from the server to the client.

If you're on the same network (like you said) then you need to ensure port 80 (or whatever port you use) is allowed by the firewall on the client machine.

An alternative is to use NetTcpBinding which opens a single outgoing tcp connection allowing duplex communucation. This is a good alternative if your clients and server are always on the same network.

see this post for more info on WSDualHttpBinding

Community
  • 1
  • 1
wal
  • 17,409
  • 8
  • 74
  • 109
  • I would really like to get wsDualHttpBinding working. The firewall is turned off. I don't believe it is a firewall issue. What other things should I look at? – xaria Aug 08 '12 at 03:59
  • not sure, you might need to use wireshark to see whats going on. also, is the client able to reach the server? (ie put a log statement on the server to see if that way works) – wal Aug 08 '12 at 08:58