SharePoint 2016 - Joining Farm failed. The exception is One or more types failed to load.

Problem

My customer was setting up her first SharePoint 2016 server in a test farm and ran into a problem creating the SharePoint configuration database using PowerShell. Her Powershell input and the output looked like this:

$ConfigDatabaseName = “SharePoint_Config”
$SQLServer = “sptest16sql.contoso.com”
$CADatabaseName = “SP2016_AdminContent”
$CAPort = 2016
$CAAuth = “NTLM”
$PassPhrase = “ILovePizza!1”
$LocalServerRole = “custom”
$sPassphrase = (ConvertTo-SecureString -String $passphrase -AsPlainText -force)

New-SPConfigurationDatabase –DatabaseName $ConfigDatabaseName –DatabaseServer $SQLServer –AdministrationContentDatabaseName $CADatabaseName –Passphrase (ConvertTo-SecureString $PassPhrase –AsPlaintext –Force) –FarmCredentials (Get-Credential) -localserverrole $LocalServerRole

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
New-SPConfigurationDatabase : One or more types failed to load. Please refer to the upgrade log for more details.
At line:10 char:1
+ New-SPConfigurationDatabase –DatabaseName $ConfigDatabaseName –DatabaseServer $S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo         : InvalidData: (Microsoft.Share...urationDatabase:SPCmdletNewSPConfigurationDatabase) [New-SPConfigurationDatabase], SPUpgradeException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPConfigurationDatabase

 

The logfile included this “Unexpected” information:

 

10/27/2016 14:16:25.63 powershell_ise (0x0B5C) 0x1268 SharePoint Foundation Upgrade SPSiteWssSequence ajywy ERROR Exception: Could not load file or assembly 'Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bc3856cd365e35' or one of its dependencies. The system cannot find the file specified. 2f98b19d-d071-0000-0000-0cc275b54164

and

Joining Farm failed. The exception type is Microsoft.SharePoint.Upgrade.SPUpgradeException The exception is One or more types failed to load. Please refer to the upgrade log for more details. StackTrace is   at Microsoft.SharePoint.Upgrade.SPActionSequence.LoadUpgradeActions()     at Microsoft.SharePoint.Upgrade.SPActionSequence.get_Actions()     at Microsoft.SharePoint.Upgrade.SPActionSequence.get_ActionsInternal()     at Microsoft.SharePoint.Upgrade.SPUtility.GetLatestTargetSchemaVersionBeforeMajorVersion(Type typeActionSequence, Int32 majorVer)     at Microsoft.SharePoint.Upgrade.SPSiteSequence.get_PreviousTargetSchemaVersion()     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.PopulateSequencesTable(StringBuilder sqlstr, Boolean siteSequence)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ConstructSiteNeedsUpgradeQuery(Guid siteId)     at Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence.GetSiteNeedsUpgrade(SPUpgradeSession session, SPContentDatabase database, Dictionary`2& dictSitesNeedUpgrade, Dictionary`2& dictSitesNeedFeatureUpgrade)     at Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence.AddNextLevelObjects()     at Microsoft.SharePoint.Upgrade.SPHierarchyManager.Grow(SPTree`1 root, Boolean bRecursing, SPDelegateManager delegateManager)     at Microsoft.SharePoint.Upgrade.SPHierarchyManager.Grow(SPTree`1 root, SPDelegateManager delegateManager)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.NeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ReflexiveNeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.NeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ReflexiveNeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.NeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ReflexiveNeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.NeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ReflexiveNeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Upgrade.SPUpgradeSession.NeedsUpgrade(Object o, Boolean bRecurse)     at Microsoft.SharePoint.Administration.SPServerProductInfo.DetectLocalUpgradeStatus()    at Microsoft.SharePoint.Administration.SPServerProductInfo.DetectLocalProductVersions(SPProductVersions prodVer)     at Microsoft.SharePoint.Administration.SPServerProductInfo.UpdateProductInfoInDatabase(Guid serverGuid)     at Microsoft.SharePoint.Administration.SPFarm.Join(Boolean skipRegisterAsDistributedCacheHost, Nullable`1 serverRole)

Cause

This customer was not running the prerequisite installer from the installation media, but rather downloading the pieces and installing them individually via a script. The source of the problem is that the WCF prerequisite was downloaded but not installed. The customer stated that the download WAS specified in the installation script, but somehow for an unknown reason did not install as expected.

Resolution

I recommended my customer install the missing assembly manually by downloading and installing "WCF Data Services 5.0 for OData V3 - https://www.microsoft.com/en-us/download/details.aspx?id=29306" and she was able to run the new-spcontentdatabase command successfully. If the WCF was already installed, I would have asked her to install the same download, then repair "Microsoft WCF Data Services 5.6” and retry the configdb creation.