Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

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

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,323 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,323 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

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,232 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans