Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to Connect Dynamic CRM with ASP.NET Core 2.1 Web API

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

I want to be able to make CRUD functions using asp.net core and connect to CRM dynamics.

  • I've installed "System.ServiceModel.Primitives", to my Core project.
  • All the tutorials suggest using 
    • Microsoft.Xrm.Sdk.dll
    • Microsoft.Crm.Sdk.Proxy.dll
  • When I added them manually as a reference and tried to connect to the CRM using the following code:
 ClientCredentials credential = new ClientCredentials();
                credential.UserName.UserName = userName;
                credential.UserName.Password = password;
                Uri serviceUri = new Uri(soapOrgServiceUrl);
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credential, null);
                proxy.EnableProxyTypes();
                return proxy;

I got an exception on runtime "TypeLoadException: Could not load type 'System.ServiceModel.Description.MetadataConversionError' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'."

Can anyone help please and tell me how to connect to CRM Dynamics using asp.net core 2.1?

*This post is locked for comments

  • Suggested answer
    Abby Kong Profile Picture
    Abby Kong 6 on at
    RE: How to Connect Dynamic CRM with ASP.NET Core 2.1 Web API

    Hi Karim,

    System.Service Model is under .Net Framework.  Not sure which version of crm SDK you are using. 

    At least for now, crm sdks assemblies only works with .Net Framework not .Net core (see highlighted sentence)

    netframework.png

    Regards,

    Abby

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: How to Connect Dynamic CRM with ASP.NET Core 2.1 Web API

    I've never done anything with ASP .Net Core, but the first thing to check is that you are targeting the .NET Framework - I'm pretty sure this wouldn't work if you target the  .NET Core

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans