Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Having an issue on random workstations running simple .net application using the SDK (CrmServiceClient)

Posted on by Microsoft Employee

Good morning,

We have a pretty complex application that our users run on their desktops to do some functions.  I realized this was not working for some and it was for others.  So, I created a very simple console application that basically connects to CRM and does a query of some entities (few lines of code).  When running this, it also works on some workstations but not for others.  It's not an authentication issue because the application lets you enter in user/passwords - it works for all users on some machines, none on the others.  I can't figure out what is missing from the client machines that this does not work on.  They all have the same versions of .net installed, windows, etc.

Error we receive is "Unable to Login to Dynamics CRM".

Also:  "System.NullReferenceException:  Object reference not set to an instance of an object"

Dynamics Version:  9.0.2.451

.Net Target Version:  4.6.2

API Version:  

Code Example:  9.0.2.4

String crmConnectionStringCurrent = String.Format("AuthType=Office365;Username={1}@blah.com; Password={0};Url=org.api.crm.dynamics.com/.../v9.0", password, username);
CrmServiceClient connTest = new CrmServiceClient(crmConnectionStringCurrent);

Does anyone have any recommendations?  Again, we have 2 workstations (very similar).  This app will run on 1 with user X and will not run (yielding above error) on the other.

Thank you!

*This post is locked for comments

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Having an issue on random workstations running simple .net application using the SDK (CrmServiceClient)

    Hi

    Just to rule out if the issue is with your application or something wring with the user's machine. You can try connecting to plugin registration tool and see if that works. If the PLT also fails to connect then there must be something wrong within the users desktop.

    Also, are you using the same credentials for each workstaion or specific user credentials?

  • Suggested answer
    PranavShroti Profile Picture
    PranavShroti 4,510 on at
    RE: Having an issue on random workstations running simple .net application using the SDK (CrmServiceClient)

    I think if utility is working on some machines and same is not working on others, then may be it is picking its reference from somewhere.  

    Things we can do are:

    1.       Remove all references from the applications

    2.       While adding DLL references make sure “local copy ” property is true. This will ensure that referenced DLLs are part of your solution and a local copy will be stored in BIN folder.

    Then run the application exe on local and server, it should work.  

    Regards,

    Pranav

    If found useful, please mark the answer as verified

  • Guido Preite Profile Picture
    Guido Preite 54,081 Super User 2024 Season 1 on at
    RE: Having an issue on random workstations running simple .net application using the SDK (CrmServiceClient)

    any chance the password of the user with issues contains characters like = " ' ; ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Having an issue on random workstations running simple .net application using the SDK (CrmServiceClient)

    I already tried explicitly telling the application to use TLS12 as other posts suggest.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans