Monday 21 January 2013

A control with ID 'topSiteMap' could not be found.

This morning I deployed a webpart to solution gallery using STSADM but it kept giving me error that a custom assembly isn't found even though it was in GAC.

I thought it might be a good idea to reference assembly and use WSP builder to deploy webpart again, so I retracted/removed using Central Admin and deployed it again using WSP builder as soon as I deployed it, I started getting this error,


Exception information:     Exception type: HttpException     Exception message: The DataSourceID of 'TopNavigationMenu' must be the ID of a control of type IHierarchicalDataSource.  A control with ID 'topSiteMap' could not be found. 
Request information:     Request URL: 

Any page I go to I get same ugly error, I looked at web application's web.config and figured out it has been recently modified, so I assumed its WSP builder that did some dirty work. I copied old back of web.config but nothing changed. I tried removing webpart completely and then add again using STSADM but still nothing changed it.

At end I started monitoring ULS logs and found multiple errors


Delegate Control: Exception thrown while building custom control 'Microsoft.SharePoint.SPControlElement': Microsoft.SharePoint.WebPartPages.WebPartPageUserException: A critical error has occurred on this page. Contact your system administrator if this problem persists.  at Microsoft.SharePoint.ApplicationRuntime.SafeControls.RethrowExceptionIfNeeded ()  at Microsoft.SharePoint.ApplicationRuntime.SafeControls.IsSafeControl (Type type, String & unsafeErrorMessage)  at Microsoft.SharePoint.Utilities.SPUtility.CreateServerControlFromAssembly (sControlAssembly String, String sControlClass)  at Microsoft.SharePoint.SPControlElement.BuildCustomControl (Template Control tctlPage, sControlAssembly String, String sControlClass, sControlSrc String, XmlNode xnElementDefinition, SPFeatureDefinition featdefElement, String sElementId)  at Microsoft.SharePoint.SPControlElement.BuildCustomControl (Template Control tctlPage)  at Microsoft.SharePoint.WebControls.DelegateControl.BuildCustomControlResilient (SPControlElement ctlelemDefinition)

I created another site collection for same web application and was getting errors for out of box webparts too.

While monitoring ULS randomly I found an error saying one of our custom utilities dll is missing, I checked gac and it wasn't there adding this custom dll in GAC and AJAXControlToolKit dll back in Web App's bin folder solved the problem.

Don't forget to do a IISReset after putting dll to gac otherwise it won't going to work.

Conclusion

Be careful while using WSP Builder for some reason when you try to "Uninstall" a solution it removes dlls from gac and web app bin's folder, not sure about web.config but you should always keep a backup copy of it.



No comments:

Post a Comment