We have SSIS jobs which retrieve incremental data from Dynamics CRM 365 and run every 2 hours. Recently we observed few jobs were failing with request channel timed out error. We figured out that these jobs were pulling data for entities with very high data volume. One of the entity was annotation since we are capturing loads of notes.
We are using script component in SSIS package which is C# code to retrieve data from CRM. C# code makes use of organization Service object for any CRUD operations in CRM.
ClientCredentials credential = new ClientCredentials();
credential.UserName.UserName = ConfigurationManager.AppSettings.Get(“Username”);
credential.UserName.Password = ConfigurationManager.AppSettings.Get(“Password”);
IOrganizationService orgService = new OrganizationServiceProxy(new Uri(strUrl), null, credential, null);
To resolve this issue, we increased Timeout property. OrganizationServiceProxy class has Timeout property which can be set to increase default value of 2 min as below: For more details please refer here.
((OrganizationServiceProxy)(orgService)).Timeout = new TimeSpan(0, 10, 0);
Add this line of code after orgService object is created above to set Timeout to 10 minutes.
In case you are using CrmConnection class, then you can directly set Timeout property using CrmConnection class object as below:
CrmConnection conn = new CrmConnection(strUrl);
conn.Timeout = new TimeSpan(0, 10, 0);