Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Connect Online CRM Rest API in .Net Core(Console App)

Posted on by 932

Hi all,

I want to connect online CRM account with Rest API(to authenticate) in .Net Core Console App to perform CRUD Operations.

But it shows an error of some compatibility issues.

Error while connecting to CRM Could not load type 'System.ServiceModel.Description.MetadataConversionError' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=34567VNXC'

How could i resolve the same? 

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Connect Online CRM Rest API in .Net Core(Console App)

    I have same problem, how did you solve the problem ?

  • ThomasN Profile Picture
    ThomasN 3,190 on at
    RE: Connect Online CRM Rest API in .Net Core(Console App)

    Hey Goutam, just wondering if above code is passing user credentials and pwd through the https call? Also this is using the organization service to get the token, which would be used in the subsequent API call back to D365, but that token for the user has an expiration.

    Not trying to argue just want to learn more myself. The only way to set token expiration is when calling for the token from Azure AD.

    If this works for Shakti that is great. Just wanted to make sure. Thanks.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Connect Online CRM Rest API in .Net Core(Console App)

    Ah!  in .NET core System.ServiceModel has been deprecated.

    I am not sure how you get may be below reference helps you -

    docs.microsoft.com/.../libraries

  • RE: Connect Online CRM Rest API in .Net Core(Console App)

    Create a new project--->Visual C#--->.Net Core(Console Application)

    Then paste your code and install all the packages.

    5661.V1.png

    But it shows an error which is:-

    5661.V1.png

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Connect Online CRM Rest API in .Net Core(Console App)

    can you share screenshot please.

  • RE: Connect Online CRM Rest API in .Net Core(Console App)

    This is not working in .Net Core console app at my end.

  • RE: Connect Online CRM Rest API in .Net Core(Console App)

    7120.V1.png

    But in my application don't show any assemblies.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Connect Online CRM Rest API in .Net Core(Console App)

    check here - Right click Add reference on the project under assembly --> framework you can find those. See here for more info-

    arunpotti.wordpress.com/.../comment-page-1

  • RE: Connect Online CRM Rest API in .Net Core(Console App)

    System.Runtime.Serialization

    System.ServiceModel

    Unable to find above assemblies.

    How could i get those assemblies?

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Connect Online CRM Rest API in .Net Core(Console App)

    Shakti ,

    dont forget to close the thread by verifying correct answers , which helps other to implement in future .

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans