Ahmed Abdullah Saeed
Ahmed Abdullah Saeed

Reputation: 707

Dynamic CRM "CrmServiceClient" unable to connect using Active Directory Authentication Mode

I am trying to connect on premises Dynamic CRM 2016 from asp.net Web Project. I am using CrmServiceClient method with Active Directory Authentication Mode.

I am getting following exception.

{"Could not load type 'Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior' from assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.":"Microsoft.IdentityModel.Clients.ActiveDirectory.PromptBehavior"}

new CrmServiceClient(
    new System.Net.NetworkCredential("adminuser", "pass", "domain"), 
    Microsoft.Xrm.Tooling.Connector.AuthenticationType.AD, 
    "http://sample.com", "4466", "DEV", useUniqueInstance:false, 
    useSsl:false)

Also Tried this

new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRM_CONN"].ConnectionString)

Upvotes: 7

Views: 4724

Answers (1)

Trond Jelsnes Undrum
Trond Jelsnes Undrum

Reputation: 113

Edited, i found the solution.

I had to downgrade: Microsoft.IdentityModel.Clients.ActiveDirectory to version 2.27 to get this working. The newer versions i tested had the same error.

Hope this works for you also!

Upvotes: 9

Related Questions