A timeout error when you use Deployment Web Service

This article provides a solution to a timeout error that occurs when you use Deployment Web Service.

Applies to:   Microsoft Dynamics CRM 2011
Original KB number:   2500491

Symptoms

A timeout error occurs when you use the Deployment Web Service of Microsoft Dynamics CRM 2011 by using Microsoft.Xrm.Sdk.Deployment.dll.

Error Message
System.TimeoutException: The request channel timed out while waiting for a reply after 00:01:59.9531229. 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.

Cause

The proxy that is created by ProxyClientHelper.CreateClient method has default timeout of 2 minutes.

Resolution

Instead of using ProxyClientHelper.CreateClient method, reference Deployment Web Service and create proxy DeploymentServiceClient service = new DeploymentServiceClient("CustomBinding_IDeploymentService").

After creating the proxy, set timeout value for SendTimeout to have enough timeout value for your operation.

Example:
// Set SendTimeout as 4 minutes.
service.Endpoint.Binding.SendTimeout = new TimeSpan(0, 4, 0);

More information

Since PowerShell uses the same dll to create proxy, there's no workaround for the timeout at this time when using PowerShell.