Friday, April 21, 2017

SharePoint 2013: Could not activate SharePoint Server Publishing web feature

Problem

Developers need to have the SharePoint Server Publishing Infrastructure (site) feature on the target site collection and the SharePoint Server Publishing (web) feature activated on the target site collection web in order for a custom solution to function successfully.  The custom solution relies upon some of the templates and pages made available by these features.  The administrator verifies that the SharePoint Server Publishing Infrastructure (site) feature is already activated and that the Publishing (web) feature is not activated.  When he tries to activate Publishing using Manage site features, activation fails.  Developers must have the SharePoint Server Publishing (web) feature activated in order to deploy.  This posting consolidates notes associated with analyzing, troubleshooting and resolving this issue.

Troubleshooting

  • Facts
    • Legacy farm, functional and operational, but having some unknown history and configuration changes.  Original SharePoint administrator long since departed.
    • Numerous customizations: sandbox, farm, deployed via WSPs, or direct modification of master pages and other pages. History of third part and in-house developed solutions added and then not used (e.g., Bamboo, Metalogix) or partially or incompletely removed (e.g., de-activated, but web parts still deployed to pages, de-activated but still installed, etc).
    • Heavily customized target site collection dedicated to delivering specific set of capabilities to small but critical user base.
    • Developers need to have SharePoint Server Publishing Infrastructure (site) feature and the SharePoint Server Publishing (web) feature activated on the target site collection in order for a custom solution to function successfully.
    • SharePoint Server Publishing Infrastructure feature already activated on the site collection and verified in Site Collection Administration > Site collection features.
    • SharePoint Server Publishing feature not activated on the web and could not be activated via Site Actions > Manage site features.
    • Correlation ID presented on activation failure.
    • Initial tentative diagnosis is failure of dependent feature to activate.
  • Troubleshooting Steps
    1. Reviewed ULS log entries: researched for correlation ID in farm server ULS logs.  Eventually found it on one of the WFEs. Reviewed log entries associated with correlation ID.  The listing contains over 200 entries and shows the various tasks associated with activating this feature. There were a number of warnings regarding Metalogix and Bamboo web parts that could be ignored.  There were then a number of entries indicating successful creation of various SharePoint objects, such as columns, lists, document libraries, and so on.  A single failure was found when it began trying to activate 404 error pages from the Publishing feature. Several timeouts (logging gaps) were seen followed by an exception being triggered.
      [timestamp] w3wp.exe (0x4D9C) 0x2B4C SharePoint Foundation General 8grz High The feature '94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb' depends on feature '22a9ef51-737b-4ff2-9346-694633fe4416' which failed to activate...
      This confirmed initial tentative diagnosis.  The what being generally answered, now analysis focused on the why and how to fix.
    2. Performed literature search: performed literature search on feature 22a9ef51-737b-4ff2-9346-694633fe4416. Found that it corresponds with the hidden web-scoped Publishing feature.
      1. SharePoint 2010: Feature GUID and Name Mapping
      2. SharePoint 2013: List of Features "ID, DisplayName, CompatibilityLevel and Scopes"
      3. Failed to activate feature 'Publishing' (ID: 22a9ef51-737b-4ff2-9346-694633fe4416)
      4. Activation Dependencies and Scope
      5. Can't activate Server Publishing
      One posting (5) suggested resolving this by de-activating / re-activating the site-scoped SharePoint Server Publishing Infrastructure feature followed by re-attempting to activate the web-scoped SharePoint Server Publishing feature.
    3. Activate Features: tried de-activating, re-activating publishing infrastructure feature followed by trying to activated publishing feature.  First performed backup of the farm. Then performed activation using UI.  After business hours.  The publishing infrastructure feature feature was de-activated / re-activated without issue.  However, trying to activate the publishing feature again resulted in failure.  Correlation ID provided.
    4. Reviewed ULS logs: performed a review of the ULS logs for the new correlation ID. Logs found on same server as previously.  Reviewed this group of entries - about the same number as previous; also presented almost identical entries.  Failure again occurred at same point.  The fact that publishing infrastructure site feature could be de/re-activated is encouraging and would appear to limit the problem scope of the issue.  Tentative diagnosis is permissions issue: folder containing 404 pages not accessible, writable, etc.
    5. Performed new literature search: performed new literature search for solutions paths. Some postings suggest using PowerShell to activate feature (3) and using the "Force" parameter.  Some internal discussion that feature activation should be performed both for Publishing infrastructure and Publishing, even though Publishing infrastructure already activated.
      1. Enable-SPFeature
      2. Publishing Feature failed to activate
      3. Can't activate 'SharePoint Server Publishing' in 'Site Features'
      4. Unable to Activate Publishing Infrastructure Feature in Site collection of SharePoint 2013
    6. Activate Features: tried de/re-activating Publishing Infrastructure feature followed by activating Publishing feature, both using the Force.  Not clear whether it was necessary to de/re-activate Publishing Infrastructure feature prior to activating Publishing feature. Script that was used:
      $siteUrl = "[URL]"
      $siteCollection = Get-SPSite $siteUrl
      Enable-SPFeature "PublishingSite" -Url $siteCollection.Url -force
      Enable-SPFeature "PublishingWeb" -Url $siteCollection.Url -force
      This time, activation succeeded for Publishing feature.  

Solution

  • Activate Publishing web feature via Enable-SPFeature using Force parameter.

References

Notes

  • Microsoft SharePoint Hierarchy: Farm > Web Application > Content Database > Site Collection > Web