Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Microsoft.IdentityModel.Clients.ActiveDirectory.dll NULL when insert rows in Dynamics 365 from windows service c#

(0) ShareShare
ReportReport
Posted on by 5

I have a program to insert rows in Dynamics 365 instance. The program runs well when i use a console app, but with the same code runs in a Windows Service program, when insert a row, show this error:

Captura-de-Pantalla-2020_2D00_11_2D00_18-a-la_2800_s_2900_-3.28.09-p._A000_m_2E00_.png

Error:  InnerException = {Microsoft.IdentityModel.Clients.ActiveDirectory.dll":null}   HResult: -2146233088

Any help to resolve this problem?

  • a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Microsoft.IdentityModel.Clients.ActiveDirectory.dll NULL when insert rows in Dynamics 365 from windows service c#

    Hello,

    Seems that you use not the pure CrmServiceClient but extension provided here - github.com/.../XrmCoreLibrary

    I haven't used it before so I have no idea what could cause issues. I would recommend to create an issue in that repo and ask for help from author of the extension.

  • RE: Microsoft.IdentityModel.Clients.ActiveDirectory.dll NULL when insert rows in Dynamics 365 from windows service c#

    Hi, sorry for the delay.

    This code is for connect to CRM Instance:

    var connectionString = @"AuthType=ClientSecret;Url=xxxxxxx.crm.dynamics.com/;ClientID=" + "xxxxxxxxx" + ";ClientSecret=" + "xxxxxxxxxxx";

    CrmServiceClient conn = new CrmServiceClient(connectionString);

    return new OrganizationServiceManager(conn);

    Later, i use this OrganizationServiceManager to execute multiple insert in CRM (_servicio is the return from the connection)

    var options = new OrganizationServiceProxyOptions()

                   {

                       Timeout = new TimeSpan(0, 40, 0)

                   };

                   IDictionary<string, ExecuteMultipleResponse> _resultadoPeticion = _servicio.ParallelProxy.Execute<ExecuteMultipleRequest, ExecuteMultipleResponse>(_colleccionBloques, options);

                   _callback(_resultadoPeticion, _colleccionBloques, _log, nombreTabla, nombreCampoEstado, nombreAtributoLlave, nombreColumnaLlave, GuardarSQL);

    IImportant:  This code works well in a console app, but inside a windows service generate the error described.

  • a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Microsoft.IdentityModel.Clients.ActiveDirectory.dll NULL when insert rows in Dynamics 365 from windows service c#

    Hello,

    Can you please provide the code that shows how you connect to CRM instance?

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans