CRM Service Exception: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies

I received the below error from a CRM WCF service that I created.  After some investigating, I found out that I received this error because I don't have Windows Identify Foundation Pack installed on my developer PC. After installing Windows Identity Foundation, the service ran as expected.

Be sure to install 6.0 if you're running Vista and 6.1 if you're running Windows 7.

--

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKey
Token=31bf3856ad364e35'
at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.CreateLocalChannelFactory()
at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1.CreateChannelFactory(ClientCredentials clientCredentials)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceConfiguration.CreateChannelFactory(ClientCredentials clientCredentials)
at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.get_ChannelFactory()
at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.CreateNewServiceChannel()
at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.ValidateAuthentication()
at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.get_ServiceChannel()
at Microsoft.Xrm.Sdk.Client.ServiceContextInitializer`1.Initialize(ServiceProxy`1 proxy)
at Microsoft.Xrm.Sdk.Client.ServiceContextInitializer`1..ctor(ServiceProxy`1proxy)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceContextInitializer..ctor(OrganizationServiceProxy proxy)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Execute(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& more Records)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression)
at Microsoft.Xrm.Sdk.Linq.Query`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Irpc.Crm.Services.Common.ReportedIssueService.GetReportedIssues(Guid pcmReportId) in C:\IRPC\Source\Irpc.Crm\Services\Irpc.Crm.Services.Common\ReportedIssueService.svc.cs:line 31
at CommonServiceTester.Program.TestReportedIssueServiceGet(ReportedIssueService service) in C:\IRPC\Source\Irpc.Crm\Test\CommonServiceTester\Program.cs:line309
at CommonServiceTester.Program.Main(String[] args) in C:\IRPC\Source\Irpc.Crm\Test\CommonServiceTester\Program.cs:line 42

Comments

  • Anonymous
    August 23, 2011
    works like a charm.. Thanks :)

  • Anonymous
    December 13, 2011
    Thank you for saving me lots of time looing for an install mate!

  • Anonymous
    April 29, 2012
    Works great thank u a lot .

  • Anonymous
    January 01, 2013
    What is the version for win 8?

  • Anonymous
    January 31, 2013
    Great man!!! First link I clicked on with a superb solution...cheers!!

  • Anonymous
    July 27, 2013
    thanks

  • Anonymous
    November 08, 2013
    I have waste my full day to connect crm. after seeing this post only I have find out actual problem. Thanks many thanks

  • Anonymous
    November 14, 2013
    Enable Windows Identity Foundation on Win 8: blog.xrm.com/.../quick-tip-enable-windows-identity-foundation-windows-8

  • Anonymous
    January 23, 2014
    Thanks a lot!!! After checked with sys admin we findout this post..... Cheers....

  • Anonymous
    March 19, 2014
    thanks, worked for me.

  • Anonymous
    May 15, 2014
    Thanks for share, this help so much!

  • Anonymous
    May 17, 2014
    Thanks a lot... Now its working..!!

  • Anonymous
    May 21, 2014
    Thanks for the help, much appreciated.

  • Anonymous
    June 03, 2014
    Wonderfull post. Thank You!

  • Anonymous
    June 29, 2014
    Thanks a lot. U saved my day. : D

  • Anonymous
    July 04, 2014
    If you're using Windows 8 or Windows 8.1 the Windows Identity Foundation you won't be able to install any of those, but it can be installed from Control Panel -> Uninstall Programs -> Turn Windows Features On Or Off ViewFull www.7tutorials.com/how-add-or-remove-unwanted-windows-features-programs-or-apps

  • Anonymous
    November 04, 2014
    Thank you! I have been having issues with installing the CRM client on Windows 10 TP which doesn't allow you to add the WIF feature to Windows.  Installed on Windows 8.1 with Outlook 2010 and works fine.

  • Anonymous
    November 10, 2014
    A full walkthrough with snapshots can be found here: thecrmclub.blogspot.com/.../Could-not-load-file-or-assembly-Microsoft.IdentityModel-exception-Dynamics-CRM.html

  • Anonymous
    June 13, 2015
    I have faced similar problem while installing while creating central admin site. Alternate link to download: ​go.microsoft.com/.../p

  • Anonymous
    August 04, 2015
    This worked like a charm thanks for the post man

  • Anonymous
    September 15, 2015
    Thank you Buddy! Works like a charm!

  • Anonymous
    December 28, 2015
    Great Man. I was unistalled Widows Identity foundation by mistake and your post solved my problem. Many thanks!!