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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

CrmServiceClient Object reference not set to an instance of an object

(0) ShareShare
ReportReport
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!

I have the same question (0)
  • Shaun W Harvey Profile Picture
    242 on at

    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

  • Suggested answer
    Community Member Profile Picture
    on at

    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 

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    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/

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans