Microsoft.SharePoint.Publishing.Navigation GetNavigationTermSetForProvider(CachedAreaLookup cachedAreaLookup, taxonomySiteMapProviderSettings providerSettings, out Exception error)
i get the "Error loading navigation: The Managed Navigation term set is improperly attached to the site" today. Seem i am not alone (http://www.shailwx.com/2012/07/sharepoint-2013-errors-error-in-managed-navigation/), however, iisreset does not works for me.
And message in ULS log does not provide more helpful information, i had to attach to w3wp and debug with Visual Studio and .net reflector.
Turned out that the following line from Microsoft.SharePoint.Publishing.Navigation.TaxonomyNavigationCache.GetNavigationTermSetForProvider(CachedAreaLookup cachedAreaLookup, taxonomySiteMapProviderSettings providerSettings, out Exception error) always return null
NavigationTermSetAttachedWeb attachedWeb = set.LoadedTermSet.GetAttachedWeb()
that is, what follows always returns null.
internal override NavigationTermSetAttachedWeb GetAttachedWeb()
{return this.termSetData.AttachedWeb;}
It seems that there should be some spweb guid written into the termset, but it is lost for my case.
The solution is to switch back to structure navigation in site settings->navigation and switch to managed navigation again. This way, the lost attached web id seems to be written again.
However, i really don't understand why the id can be missing. I remember this morning when i edit the managed termset, the "use this term set for site navigation" in "intended use" for the term set was incorrectly unchecked. I wonder whether this could have caused the problem.