Error: .Net SqlClient Data Provider: System.Data.SqlClient.SqlException: HostId is not registered

Being recently cursed by the error:
.Net SqlClient Data Provider: System.Data.SqlClient.SqlException: HostId is not registered
   at Microsoft.ResourceManagement.Utilities.ExceptionManager.ThrowException(Exception exception)
   at Microsoft.ResourceManagement.Data.Exception.DataAccessExceptionManager.ThrowException(SqlException innerException)
   at Microsoft.ResourceManagement.Data.DataAccess.RetrieveWorkflowDataForHostActivator(Int16 hostId, Int16 pingIntervalSecs, Int32 activeHostedWorkflowDefinitionsSequenceNumber, Int16 workflowControlMessagesMaxPerMinute, Int16 requestRecoveryMaxPerMinute, Int16 requestCleanupMaxPerMinute, Boolean runRequestRecoveryScan, Boolean& doPolicyApplicationDispatch, ReadOnlyCollection`1& activeHostedWorkflowDefinitions, ReadOnlyCollection`1& workflowControlMessages, List`1& requestsToRedispatch)
   at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.RetrieveWorkflowDataForHostActivator()
   at Microsoft.ResourceManagement.Workflow.Hosting.HostActivator.ActivateHosts(Object source, ElapsedEventArgs e)
  And subsequent:
  ILM Certificate could not be created: Cert step 2 could not be created: C:\Program Files\Microsoft Office Servers\15.0\Tools\MakeCert.exe -pe -sr LocalMachine -ss My -a sha1 -n CN=”ForefrontIdentityManager” -sky exchange -pe -in “ForefrontIdentityManager” -ir localmachine -is root
 I realised I was in the land of the repeated ForeFront Certificate problem. This occurs when ForeFront Certificates already exist.
 CleverWorkarounds has a good writeup about it.
 Basically, you need to get rid of the FIM Certs before you start the sync service. It’s a bit of a pain to go through all the objects. I kept missing some and would have to start over again.
 Here is a script to remove the ForeFrontIdentityManager Certificates off your server for you:
 net stop sptimerv4
net stop spadminv4

 sl cert:
 Get-ChildItem -Recurse | Where { $_.Issuer -eq “CN=ForefrontIdentityManager” }
Get-ChildItem -Recurse | Where { $_.Issuer -eq “CN=ForefrontIdentityManager” } | Remove-Item
Get-ChildItem -Recurse | Where { $_.Issuer -eq “CN=ForefrontIdentityManager” }
 net start sptimerv4
 net start spadminv4
Even after getting rid of all the FIM Certs, it still wouldn’t run. I had moar errors:
ILM Certificate could not be created: netsh http error:netsh http add urlacl url=http://+:5726/ user=domain\svc_spfarm sddl=D:(A;;GA;;;S-1-5-21-4215000165-3197143036-532513930-5390)
ILM Certificate could not be created: netsh http error:netsh http add urlacl url=http://+:5725/ user=domain\svc_spfarm sddl=D:(A;;GA;;;S-1-5-21-4215000165-3197143036-532513930-5390)

And I deleted both of the Discresionary Access Lists ( acl )

netsh http delete urlacl url=http://+:5725/
netsh http delete urlacl url=http://+:5726/


And that did the trick.

Also note that I saw this happen in one instance when the FQDN was different from the NetBIOS name and I hadn’t set the NetBIOSDomainNamesEnabled to 1.

If you can’t tell the difference between and FQDN and the NetBIOS name of your server, look at the environment variables …

Now, why oh why the SharePoint installer doesn’t check this, or why SPAutoInstaller doesn’t check this I don’t know. But it’s worth looking at, especially if the User Profile Service Application is driving you nuts and it won’t perform a sync, or gets stuck on synchronising or something similar.