Thursday 22 December 2011

Error opening every Document Library in a Web Application

Credit:
My esteemed colleague Andrew Haughan and I worked on this issue together I cannot take full credit for the resolution to this issue.

We have a newly created Web Application that has been configured, trying to open any document library on the site was causing the standard and very helpful "An unexpected error has occurred" SharePoint Correlation ID error message.


A visit to the ULS logs (using ULSViewer of course) uncovered the following unexpected error for that Correlation ID:

System.NullReferenceException: Object reference not set to an instance of an object.   
 at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.get_ApplicationProperties()    
 at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.get_PartitionIDs()    
 at Microsoft.Office.Server.Administration.UserProfileApplicationProxy.IsAvailable(SPServiceContext serviceContext)    
 at Microsoft.Office.Server.WebControls.MyLinksRibbon.get_PortalAvailable()    
 at Microsoft.Office.Server.WebControls.MyLinksRibbon.EnsureMySiteUrls()    
 at Microsoft.Office.Server.WebControls.MyLinksRibbon.get_PortalMySiteUrlAvailable()    
 at Microsoft.Office.Server.WebControls.MyLinksRibbon.OnLoad(EventArgs e)    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Control.LoadRecursive()    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


From this error message we can determine that we have an issue consuming the User Profile Service.  A simple overview of our environment is an Enterprise Services Farm running a central User Profile Service Application.  We have several farms that consume this service, to protect the innocent this Farm will be called "Farm A" and the Web Application throwing the Correlation error will be called "Web Application B":


There are many ways to start diagnosing this issue 95% of the time I have found that this issue arises due to lack of permissions of the Web Application's Application Pool identity.  The identity that runs the web application must have permissions to read from the User Profile Service Application.  This was the case in this scenario.  To check the permissions of the user profile service application:

  1. Load Central Administration on the Farm that hosts the User Profile Service Application (Enterprise Services Farm)

  2. Select Manage Service Applications under Application Management

  3. Select just to the right of the User Profile Application (do not click the actual text or it will take you to the management page)
  4. Click Permissions in the ribbon


  5. Check to ensure the Web Application Identity is not in the list
  6. Type the Web Application Identity in the people box and click Add (not OK)
  7. Select Full Control
  8. Click OK
Hopefully this will resolve your issue.  I have seen the following issues:
  • If you are publishing with Threat Management Gateway ensure that you are pointing directly to the Enterprise Services Server and not going into the TMG NIC in the DMZ.  Update your HOST file on the Web Server in Farm A to point directly to the Enterprise Services Server

No comments:

Post a Comment