web
You’re offline. This is a read only version of the page.
close
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

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

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at

    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

  • Suggested answer
    Abby Kong Profile Picture
    6 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans