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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s