Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy is not thread safe?

(0) ShareShare
ReportReport
Posted on by

Hi, I was reviewing the best practices documentation regarding the OrganizationServiceProxy class. In the section Improve service channel allocation performance, it states:

"Notice that the returned service reference is not thread safe so multi-threaded applications will need to allocate one instance per thread."

Our application is a web API endpoint with multiple concurrent callers.  The code provided by our CRM developer uses a singleton OrganizationServiceProxy that all requests use without coordination. If it is not thread safe, what kind of problems could we run into? I suspect the problems may not manifest themselves until there is enough load.

What is the typical approach for handling multiple concurrent requests?  Create a object pool of OrganizationServiceProxy objects?

*This post is locked for comments

  • RE: Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy is not thread safe?

    I will definitely take a read of this tomorrow when I am at work. Thanks. Will mark as answer after reviewing these posts tomorrow.

  • Suggested answer
    RE: Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy is not thread safe?

    Refer this:

    develop1.net/.../Simplified-Connection-Management-Thread-Safety-(Revisited).aspx

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 19 on at
    RE: Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy is not thread safe?

    Hi!

    You can use the new XrmTooling assembly as I describe here - community.dynamics.com/.../simplified-connection-management-amp-thread-safety-revisited

    Hope this helps

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans