Kasper Wittrup Kasper Wittrup - 2 months ago 15
C# Question

The request channel timed out while waiting for a reply

I have a small application that uses WCF to communicate with a webserver. This program is used by some 200 clients, and each client is sending in about 5-20 requests/min.

Looking at the error logs I often get:

The request channel timed out while waiting for a reply after

The requests are made as follows:

ClientService Client = new ClientService();

This is the app.config

<startup><supportedRuntime version="v2.0.50727"/></startup><system.serviceModel>
<binding name="WSHttpBinding_IClientService" 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="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
<endpoint address="PATH TO SERVICE"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IClientService"
contract="IClientService" name="WSHttpBinding_IClientService">
<dns value="localhost" />

Of the "many calls" each day about 200-800 fails. And about n-1 are ok. I am very confused what the issue can be. Looking at the server stats, its hardly building up a sweat - each request takes <2 sec to process.The data its sending consists of "int" or "very small strings" - so, its not due to size, if it was - there should be a consistent failure..



It seems that your requests are queuing up on server before being handled and then starts to time out. You can try couple of things here to see exactly whats going on

1) Try throttling in your WCF services e.g: Try increasing your concurrent sessions. Take a look WCF Throttling

2) Try using PerCall rather than Using Sessions here to make sure that no session remains there. Here is what you can do on your interface to remove session

[ServiceContract(Namespace="YOUR NAMESPACE", SessionMode=SessionMode.NotAllowed)]

and your contract classes implementing those interface

ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]

AND .... You should enable tracing to see exactly whats going on .