I'm trying to use CrmServiceClient class from the last CRM SDK to retrieve data from a Dynamics 365 environment.
CrmServiceClient caches connection info, even when new instances of CrmServiceClient are created and disposed!. My application connects to different CRMs urls, so I use the flag "RequireNewInstance=true;" in the connection string to avoid caching.
When this flag is used, the performance is terrible (more than 30 seconds to retrieve any data).
Any clues how can I get acceptable performance when accessing different online CRMs?
Here is a simple sample code, but any service call takes a lot of time, not just this:
string connectionString="Url=mytest.api.crm.dynamics.com; Username=myUser@myTest.onmicrosoft.com; Password=myPassword; AuthType=Office365;RequireNewInstance=true;"; using (var client = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString)) { var orgService = (IOrganizationService)client.OrganizationWebProxyClient ?? client.OrganizationServiceProxy; var response = (RetrieveVersionResponse)orgService.Execute(new RetrieveVersionRequest()); }
Note: I used to use the CrmConnection class from previous SDKs, this had much better response times but now this cannot be used to access CRM online (v 8.1.1 or above)






