Tuesday, October 30, 2012

WCF Duplex service exceeded timeout of 00:00:00

In case you use WCF duplex services using wsDualHttpBidning there is a chance to get a very strange error:

The HTTP request to 'http://vasil-trifonov.blogspot.com/DuplexService.svc' has exceeded the allotted timeout of 00:00:00. The time allotted to this operation may have been a portion of a longer timeout.
StackTrace: at System.ServiceModel.Channels.HttpChannelUtilities.SetRequestTimeout(HttpWebRequest request, TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

It turns out that the server where the service is hosted did not see the machine that calls the service. So if you get this error make sure that the server can ping the caller.

Another problem can be that the server may not be able to resolve the temporary listening address as it will be something like


the remote machine may be in another domain and may not be able to resolve the caller by name. In that case you can use the clientBaseAddress in the caller configuration
 <binding name="duplexBinding" closeTimeout="00:01:00"
  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
  transactionFlow="false" hostNameComparisonMode="StrongWildcard"
  maxBufferPoolSize="524288" maxReceivedMessageSize="1073741824"
  messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
  <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
  <reliableSession ordered="true" inactivityTimeout="00:10:00" />
  <security mode="Message">
   <message clientCredentialType="Certificate"/>
We can use the clientBaseAddress to set the IP Address as the base address for the callback channel. We can also set another port there if we want.

No comments:

Post a Comment