我正在使用 SPWebConfigModification 类进行一些 web.config 修改。当将它们添加到 WebApplication 并对其调用 Update 时,它会抛出 SecurityException,尽管
- 我以提升的权限运行代码
(并打开 SPSite 的新实例)
- 我的程序集在 GAC 中
- 应用程序池帐户来自wss_admin_wpg组和 web.config 文件有wss_admin_wpg写
权限。
Code
SPSecurity.RunWithElevatedPrivileges(delegate()
{
addProviderProxy(properties);
});
其中 addProviderProxy(SPItemEventProperties 属性)
using (SPSite site = new SPSite(properties.SiteId))
using (SPWeb web = site.OpenWeb())
{
ensureSectionGroup(web);
...
}
其中 EnsureSectionGroup(SPWeb web)
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:
尝试在 PowerShell 脚本中运行此命令,然后重试更新:
$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentService.RemoteAdministratorAccessDenied = $false
$contentService.Update()
我仍在掌握 2010 年权限的窍门,所以请珍惜它的价值。根据保罗·科特利亚尔 http://unclepaul84.blogspot.com/2010/06/sppersistedobject-xxxxxxxxxxx-could-not.html,这会有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)