Running SPWebApplication.Update with a system account raises a SecurityException

I am making some changes to web.config with the SPWebConfigModification class. When you add them to WebApplication and call Update, it throws me a SecurityException, though

  • I run the code with elevated privileges (and open a new instance of SPSite)
  • My build is in the GAC
  • The application pool account from the wss_admin_wpg group and the web.config file have wss_admin_wpg write permissins.

code

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    addProviderProxy(properties);
});

where addProviderProxy (SPItemEventProperties properties)

using (SPSite site = new SPSite(properties.SiteId))
using (SPWeb web = site.OpenWeb())
{
  ensureSectionGroup(web);
  ...
}

where makeSectionGroup (SPWeb website)

  SPWebApplication webApp = web.Site.WebApplication; 
  ...
  webApp.Update(); <--Throws exception here

Exception Details

System.Security.SecurityException was caught
  Message="Piekļuve liegta." //(Translates to something like "Access Denied")
  Source="Microsoft.SharePoint"
  StackTrace:
       at Microsoft.SharePoint.Administration.SPPersistedObject.Update()
       at Microsoft.SharePoint.Administration.SPWebApplication.Update()
       at Balticovo.SharePoint.AdjustWebConfigForOutlook.ensureSectionGroup(SPWeb web)
  InnerException: 
+3
source share
2 answers

" " SPPersistedObject.Update(), , , , . , SharePoint (, , SP).

, SQL SQL Profiler, , . , , , .

Update:

, " ". db_owner , , , - . ( ), .

, SQL Server Management Studio. SQL Profiler , . WSS_Content_Application_Pools / data_reader data_writer.

+1

PowerShell script, :

$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentService.RemoteAdministratorAccessDenied = $false
$contentService.Update()

2010 , , . Paul Kotlyar, .

+4

Source: https://habr.com/ru/post/1717049/


All Articles