Increase service timeout using Microsoft.Xrm.Client.dll CrmConnection class

The request channel timed out while waiting for a reply after 00:01:59.9844005. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation.

The error message above is caused by the maximum amount of time a single channel operation has to complete before a timeout fault is raised on a service channel binding being reached.

The fix for this, when not using Microsoft.Xrm.Client.dll’s CrmConnection class to connect to CRM, is well documented in several posts, (such as Dynamics CRM in the Field).

When using the Microsoft.Xrm.Client.dll’s CrmConnection class to connect to CRM, we can achieve the same thing by setting the Timeout property on the CrmConnection.

Microsoft.Xrm.Client.CrmConnection connection = new Microsoft.Xrm.Client.CrmConnection("ConnectionStringName");
connection.Timeout = new TimeSpan(0, 5, 0);
// Do something that will take longer than 2 minutes
Advertisements