代码之家  ›  专栏  ›  技术社区  ›  Janis Veinbergs

使用系统帐户执行SPWebApplication.Update会引发SecurityException

  •  3
  • Janis Veinbergs  · 技术社区  · 15 年前

    • 我使用提升的权限运行代码 (并打开SPSite的新实例)
    • 应用程序池帐户来自 wss_admin_wpg wss_admin_wpg 许可证。

    密码

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

    其中addProviderProxy(SpiteEventProperties属性)

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

    其中ensureSectionGroup(SPWeb)

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

    例外情况详细信息

    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: 
    
    2 回复  |  直到 15 年前
        1
  •  4
  •   Scott M    14 年前

    请尝试在PowerShell脚本中运行此脚本,然后重试更新:

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

    Paul Kotlyar ,那会有帮助的。

        2
  •  1
  •   Alex Angas Colin    15 年前

    更新:

    您可以通过将用户添加到服务器场管理员组来授予配置数据库的权限。这给了他们数据库的db_所有者权限,这并不理想,因为这意味着该帐户可以做任何事情。但是,没有其他方法(据我所知)可以访问此数据库。

    WSS_Content_Application_Pools data_reader data_writer 角色。

    推荐文章