priyanka.sarkar
priyanka.sarkar

Reputation: 26538

Time out issue in WCF

I am having time out issue in WCF.

The following is the error:

{"The request channel timed out while waiting for a reply after 00:00:59.9843744. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout."}

After searching in google, I found the solution

from this site

http://social.msdn.microsoft.com/Forums/en-US/peertopeer/thread/38306972-3128-4f0c-937b-5d162d4d8e74

So I changed accordingly my app.config file

<behavior name="ContactServiceBehaviour">
  <serviceMetadata httpGetEnabled="true" />
  <dataContractSerializer maxItemsInObjectGraph="1000000000"/>
  <serviceDebug includeExceptionDetailInFaults="true" />
  <serviceThrottling    maxConcurrentCalls="100"
                      maxConcurrentSessions="100"
                      maxConcurrentInstances="100"/>
</behavior>

What is the solution?

Upvotes: 10

Views: 21872

Answers (2)

Andrew Harry
Andrew Harry

Reputation: 13909

The forum post you mention is a red herring. The error message clearly states that you need to increase the timeout property in the WCF client and service. (if you change it in the service I have found that it doesn't always get picked up by the client when it is updated)

In Visual studio goto the Tools menu, there you will find the 'WCF Service Configuration Editor'. Load your projects web.config and define a new Binding for your service.

The setting to change is the SendTimeout value. It is 60 seconds by default.

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="WCFBinding" sendTimeout="00:02:00">
    </binding>
  </basicHttpBinding>
</bindings>

Upvotes: 20

ShawnFeatherly
ShawnFeatherly

Reputation: 2638

If you want to handle the timeout, you can wrap the client side call of the WCF service in a try/catch block.

There's a trick here, if you don't have a debugger attached, a timeout will cause the catch block to be executed. However, if you do have a debugger attached, the debugger intercepts the error before it gets to the catch block.

Upvotes: 0

Related Questions