web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
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?

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

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

  • Leonardo Castillo Profile Picture
    5 on at

    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
    84,331 Most Valuable Professional on at

    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Pallavi Phade Profile Picture

Pallavi Phade 102 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 55 Super User 2026 Season 1

#3
ManoVerse Profile Picture

ManoVerse 51 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans