Monday, March 03, 2014

WCF client: The request channel timed out while waiting for a reply after 00:00:59.998

Problem

A WCF service that needs to prepare a list of technical data which it requests from an external system, needs between 1 and 2 minutes to respond. The WCF client times out with the message

“The request channel timed out while waiting for a reply after 00:00:59.998…”

Solution

Increase the send timeout value on the client service instantiation.

MyWcfService.MyWcfServiceClient dsvc = new MyWcfServiceClient();
//TimeSpan(days, hours, minutes, seconds) - increase send timeout to wait for 10 minutes
dsvc.Endpoint.Binding.SendTimeout = new TimeSpan(0, 0, 10, 0);  

Disadvantage


Every client application needs to set the timeout value. In this particular case it would be sufficient to set the timeout value on the service server side, preferably with values in web.config. I need to investigate this further.

No comments: