Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The request channel timed out while waiting for a reply

Tags:

c#

wcf

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 00:00:59.9989999

The requests are made as follows:

ClientService Client = new ClientService(); Client.Open(); Client.updateOnline(userID); Client.Close(); 

This is the app.config

<configuration> <configSections> </configSections> <startup><supportedRuntime version="v2.0.50727"/></startup><system.serviceModel>     <bindings>         <wsHttpBinding>             <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"                 allowCookies="false">                 <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" />                 </security>             </binding>         </wsHttpBinding>     </bindings>     <client>         <endpoint address="PATH TO SERVICE"             binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IClientService"             contract="IClientService" name="WSHttpBinding_IClientService">             <identity>                 <dns value="localhost" />             </identity>         </endpoint>     </client> </system.serviceModel> 

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

Suggestions?

like image 739
Kasper Wittrup Avatar asked Jun 26 '12 20:06

Kasper Wittrup


2 Answers

Try adding the timeout values to both the service AND the client:

<binding name="BasicHttpBinding_SomeName" closeTimeout="00:01:00"     openTimeout="00:01:00" receiveTimeout="00:10:00"     sendTimeout="00:10:00" maxBufferPoolSize="2147483647"     maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
like image 188
NTDLS Avatar answered Sep 21 '22 08:09

NTDLS


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 .

like image 22
Tabish Sarwar Avatar answered Sep 19 '22 08:09

Tabish Sarwar