SPWebConfigModification クラスを使用して web.config の変更を行っています。それらを WebApplication に追加して Update を呼び出すと、SecurityException がスローされますが、
- 昇格された特権でコードを実行します (そして、SPSite の新しいインスタンスを開きます)
- 私のアセンブリはGACにあります
- アプリケーション プール アカウントは wss_admin_wpgグループからのものであり、web.config ファイルにはwss_admin_wpg書き込み権限があります。
コード
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: