Отказано в доступе при активации функций, реализующих SPFeatureReceiver?

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/35763

Вопрос

Мы разработали несколько функций, реализующих интерфейс SPFeatureReceiver.Когда я попробовал это в среде разработки, сначала это не удалось, пока я не нашел этот скрипт из MSDN:

function Set-RemoteAdministratorAccessDenied-False() 
{ 
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null 
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration") > $null 

    # get content web service 
    $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService 
    # turn off remote administration security 
    $contentService.RemoteAdministratorAccessDenied = $false 
    $contentService.Update()          
} 

Set-RemoteAdministratorAccessDenied-False

После запуска скрипта и сброса IIS все это хорошо сработало при разработке, и мы смогли активировать функцию (как администратор фермы) в Site Settings > Manage Site Features с областью действия, установленной на сайте http://mysolution/_layouts/ManageFeatures.aspx?Scope=Site.После активации мы снова вернули свойству RemoteAdministratorAccessDenied значение true и выполнили новый IISRESET.

На рабочем сервере мы использовали ту же процедуру после развертывания функции:

  1. Установите для RemoteAdministratorAccessDenied значение false
  2. IISRESET и попытался активировать эту функцию, но это не удалось.

Сообщение об ошибке, которое мы получили в ответ, выглядит следующим образом:

    Server Error in '/' Application.
--------------------------------------------------------------------------------

Security Exception 
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 

Exception Details: System.Security.SecurityException: Access Denied.

Source Error: 

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.  

Stack Trace: 


[SecurityException: Access Denied.]
   Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate() +27451643
   Microsoft.SharePoint.Administration.SPJobDefinition.Update() +152
   Company.IssueTracker.Features.NewIssueTimerJob.NewIssueTimerJobEventReceiver.FeatureActivated(SPFeatureReceiverProperties properties) +837
   Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) +25671814
   Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce) +25676799
   Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly) +27776095
   Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, String featureName, Version version, SPFeaturePropertyCollection properties, Boolean force, Boolean fMarkOnly, SPFeatureDefinitionScope featdefScope) +150
   Microsoft.SharePoint.SPFeatureCollection.Add(Guid featureId, Boolean force, SPFeatureDefinitionScope featdefScope) +83
   Microsoft.SharePoint.WebControls.FeatureActivator.ActivateFeature(Guid featid, SPFeatureDefinitionScope featdefScope) +699
   Microsoft.SharePoint.WebControls.FeatureActivatorItem.BtnActivateFeature_Click(Object objSender, EventArgs evtargs) +140
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11058199
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11057738
   System.Web.UI.Page.ProcessRequest() +91
   System.Web.UI.Page.ProcessRequest(HttpContext context) +240
   ASP._layouts_managefeatures_aspx.ProcessRequest(HttpContext context) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4963; ASP.NET Version:2.0.50727.4971 

Мое окружение:Sharepoint Server 2010

Реализованные вопросы в SharePoint 2007:

Это было полезно?

Решение

Если блоги, которые С.ссылка на не помогает, я бы попытался сделать функцию WebApplication ограниченной, что, вероятно, правильно, поскольку вы добавляете новый timerjob.

Я предполагаю, что при FeatureDeactiving вы снова удаляете задание.В этом случае у вас возникнет проблема, если кто-то активирует функцию в двух сетях, а затем удалит ее из одной из них.

Другие советы

Я полагаю, ваша проблема здесь уже решена? FeatureActivated приемник событий, предоставляющий отказ в доступе при попытке установить свойство WebApplication и этот вопрос более подробно объясняется здесь http://blog.bugrapostaci.com/tag/remoteadministratoraccessdenied/

Надеюсь, это поможет, C:\Marius

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top