Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

CrmServiceClient Object reference not set to an instance of an object

Posted on by 255

Hi

I've been trying to change to oAuth since my connections started to fail today.
I've used what I've seen on the net but it's not working.

M previous code was;

        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        CrmServiceClient service = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRMLIVE"].ConnectionString);

And Ive changed to use a new conncegion string like

            CrmServiceClient service = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CrmConnectionString"].ConnectionString);

In my web.config i have the string;


It's not working. LastCRMerror is Unable to Login to Dynamics CRM

And Object reference not set to an instance of an object

HELP!

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: CrmServiceClient Object reference not set to an instance of an object

    Hi,

    I have created new console application to connect to CRM from C#. Please download the source code from my github page link below and replace UR, Username & Password

    github.com/.../WorkWithCsharp

    Make sure you are updating your assembly to latest version using NUget package manager.

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CrmServiceClient Object reference not set to an instance of an object

    Hi,

    Pleas follow the below link and video you will get your answer yourself.

    https://juniorazurecrm.blogspot.com/

    https://www.youtube.com/watch?v=X7H25FZHoF0&t=3s

    Please fell free to like and subscribe my YouTube channel

    Thanks,

    Arshad 

  • Shaun W Harvey Profile Picture
    Shaun W Harvey 240 on at
    RE: CrmServiceClient Object reference not set to an instance of an object

    Stuie,

    The connection string looks OK from what I can see. It certainly looks like the ones I have that work.

    This may seem like a silly question but are you using an up to date version of the CoreAssemblies from Nuget?

    The connection failed errors are not that helpful, sometimes a slightly out of date DLL can be all it takes.

    Regards,

    Shaun

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans