Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

Performance degradation when using CrmServiceClient and AuthType OAuth in Dataverse

Posted on by 80

I've got an MVC.NET solution that calls the Dataverse API and I'm seeing a significant performance degradation when using CrmServiceClient and AuthType=OAuth compared with the (soon to be deprecated) WS-Trust connection (AuthType=Office365)

This is the code used for creating the CrmServiceClient connection (AuthType=OAuth)

var conn = new CrmServiceClient(connectionString);

var service = (IOrganizationService) conn.OrganizationWebProxyClient ?? conn.OrganizationServiceProxy;

and this is the code used for creating WS-Trust connection (AuthType=Office365)

var target = CrmConnection.Parse(connectionString);
            
target.ServiceConfigurationInstanceMode = ServiceConfigurationInstanceMode.PerName; 

var service = (OrganizationService) CrmConfigurationManager.CreateService(target, "DataverseServiceName");

has anyone experienced the same issue?

  • juancho Profile Picture
    juancho 80 on at
    RE: Performance degradation when using CrmServiceClient and AuthType OAuth in Dataverse

    In our case the issue was that we were using an old version of the CrmSdk, using the latest version (9.0.2.42) solved our problem

    www.nuget.org/.../9.0.2.42

    We also have issues with impersonation when setting the caller id (docs.microsoft.com/.../microsoft.xrm.tooling.connector.crmserviceclient.callerid, if you are running several threads and initiating multiple connections with different callerids, we found that it's not thread safe and some calls to impersonate one user might get mixed up by another user even if:

    - disablecrossthreadsafeties is set to false (docs.microsoft.com/.../microsoft.xrm.tooling.connector.crmserviceclient.disablecrossthreadsafeties

    - RequireNewInstance is set to true (docs.microsoft.com/.../use-connection-strings-xrm-tooling-connect

    We ended up having to cache each IOrganizationService per callerid to prevent it

  • Franji Profile Picture
    Franji 25 on at
    RE: Performance degradation when using CrmServiceClient and AuthType OAuth in Dataverse

    Hello,

    We too have started to get that performance degradation when we start using AuthType=OAuth, we are also using CrmServiceClient to connect.

    Have you found any solution? The truth is that it is penalizing us a lot.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,556 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,625 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans