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.
<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.