When enabling the Publishing feature on a site collection, you may encounter an Access Denied error. Digging into the Event logs, you'll see an Event ID: 4965 for Publishing Provisioning.
Event Type: Error
Event Source: Office SharePoint Server
Event Category: Publishing Provisioning
Event ID: 4965
Time: 10:05:00 AM
Event log message was: 'Failed to provision the scheduling job definitions. Page scheduling will not succeed.'. Exception was: 'System.Security.SecurityException: Access denied.
at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.SharePoint.Publishing.Internal.RootProvisioner.AddSchedulingJobDefinitions(SPSite site)
The Zone of the assembly that failed was:
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Reason For Error:
This error is happening because the account servicing the application pool which your site is in does not have sufficient access. When you are trying to enable the Publishing feature, it's creating a job definition that does not have access to the SharePoint_Config Database.
Work Around / Solution:
To enable the Publishing feature, you need to temporarily change the App Pool service account to be the same account as the Central Administration App Pool account.
- Change App Pool account to Central Admin Account
- Recycle App Pool
- Enable Feature
- Change App Pool account back to original account
- Recycle App Pool
Change the App Pool account in Central Administration > Operations > Service Accounts
Recycle the App Pool within IIS by Right Clicking on the application pool that is running your SharePoint site, and selecting Stop. Then select Start.