Sharepoint Timer job问题汇总

 

  1. 解决方案发布最好发布到GAC中,使用WebApplication很多时候会有问题。TimerJob并非是在IIS下运行,所以发布到wss目录下的dll不能使用。
  2. 如果解决方案中只有一个Timer Job的Feature,会导致只能全局部署,无法只部署在某个web application中。笨解决办法是添加一个可视web part的Feature,完全不用它即可。
  3. Timer Job不可以发布在web级别,至少应该是Site级别的。推荐Site级别,这样在该站点下就可以看到了。另:如是Web Application级别的,则需要在"应用程序管理"---"管理Web应用程序"---选中---"管理功能"中管理。
  4. 使用Site级别的Feature创建Timer Job时候可能会提示权限不足。解决办法是需要开启远程管理员权限。方法见底部,注意IISreset。
  5. 发布时注意是否有引用的资源,如需要引用资源需一并发布。
  6. 因环境问题,很多时候发布后都需要去管理中心的管理解决方案中部署。再去相应位置启用Feature。
  7. 如发布后显示成功,但是代码依旧是旧的代码,则需要清空缓存。方法见http://www.cnblogs.com/ceci/p/6014684.html
  8. Timerjob较为彻底的排查问题是需要 GAC检查、缓存清理、TimerJob服务重启、IISReset等方式。依旧不行的话,直接在站点中放个Log List来记录Log吧。
  9. 遭遇过管理中心看不到Timer Job,但是实际已经部署成功的情况。在附加IIS进程,debug到创建Timer Job的步骤后就正常出现了。原因不明。

          

 

 

开启远程服务器管理员权限

参见: https://support.microsoft.com/zh-cn/help/2564009/access-denied-when-deploying-a-timer-job-or-activating-a-feature-from-sharepoint-2010-content-web-application

 

  //Console app code

SPWebService myService = SPWebService.ContentService; 
myService.RemoteAdministratorAccessDenied = false; 
myService.Update(); 

 

//PowerShell code

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

 

注意IISReset。

 

另外方法:

protected override bool HasAdditionalUpdateAccess()
  {
       return true;
  }

https://sharepoint.stackexchange.com/questions/49222/access-denied-while-activating-custom-timer-job
posted @ 2017-05-05 14:12  邑尘  阅读(707)  评论(0编辑  收藏  举报