Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 358
Ahmed Abdullah Saeed Avatar asked Jun 28 '16 12:06

Ahmed Abdullah Saeed


1 Answers

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!

like image 103
Trond Jelsnes Undrum Avatar answered Oct 19 '22 20:10

Trond Jelsnes Undrum