Click here to Skip to main content
15,886,362 members
Articles / Programming Languages / C#

WCF Duplex Service Exceeded Timeout of 00:00:00

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
18 Feb 2013CPOL 13.9K   3   2
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.

In case you use WCF duplex services using wsDualHttpBinding, 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:

http://trifonov-pc/Temporary_Listen_Addresses/4881e24d-9d46-48dd-a013-399d8fab8757/ccc1d9b8-adbb-479d-a721-517b2162ad6c

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.

XML
<wsDualHttpBinding>
 <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" 
  clientBaseAddress="http://192.168.0.100/Temporary_Listen_Addresses">
  <readerQuotas maxDepth="32" maxStringContentLength="2147483647" 
  maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
  <reliableSession ordered="true" inactivityTimeout="00:10:00" />
  <security mode="Message">
   <message clientCredentialType="Certificate"/>
  </security>
 </binding>
</wsDualHttpBinding>

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Telerik
Bulgaria Bulgaria
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionCannot get this working over the internet Pin
Lawrence Thurman16-Jul-14 2:08
Lawrence Thurman16-Jul-14 2:08 
AnswerRe: Cannot get this working over the internet Pin
Vasil Trifonov16-Jul-14 2:57
Vasil Trifonov16-Jul-14 2:57 
If you want to make this work for the internet, the caller machine should have a public IP address(or have set up some kind of port forwarding) and should be accessible on the port specified in the clientBaseAddress. You should be able to connect from the service machine to the caller machine on the specified port using telnet.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.