Extending Timeouts when dealing with Slow Dynamics 365 API Performance

By default , the CRM Service Proxy timeouts after 2 minutes. Recently a client of ours was having issues with their tenant. The API performance was 100 times slower due to an internal system at MS.

This meant that our client applications were giving up after the 2 minutes. It was necessary to override the time out.

CrmServiceClient  conn = new CrmServiceClient(connectionString);
IOrganizationService _orgService = conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;
conn.OrganizationServiceProxy.Timeout = new TimeSpan(0, 5, 0);

The above line (highlighted in red) allowed us to set the new time out range which in this case was 5 minutes.

This allowed the applications to give the services a bit more time before giving up whilst the Dynamics performance was being rectified internally.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.