【问题标题】:SharePoint 2016 Custom Timer Job Not Showing in Job DefinitionSharePoint 2016 自定义计时器作业未显示在作业定义中
【发布时间】:2021-12-05 22:25:46
【问题描述】:

我陷入了 SharePoint 的一些非常奇怪的行为。 我有一个 SharePoint 2016 场解决方案。其中包含 5 个计时器作业类。 当我在任何工作类别中更改某些内容时。突然之间,这 5 个工作中的任何一个都停止显示在工作定义中。 1 个月后,它再次开始出现在定义中。 此外,如果我创建一个新解决方案并在其中创建任何作业并进行部署,它也不会显示在作业定义中。

工作列表

工作定义

【问题讨论】:

    标签: sharepoint sharepoint-2013 central


    【解决方案1】:

    您是否使用 Feature EventReviever 在 Job Definitions 中添加和配置 Job?

    这将在作业定义部分添加作业,如果您激活该功能,停用功能将删除作业。

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            try
            {
                SPSecurity.RunWithElevatedPrivileges(delegate ()
                {
                    SPWebApplication parentWebApp = (SPWebApplication)properties.Feature.Parent;
                    DeleteExistingJob(JobName, parentWebApp);
                    CreateJob(parentWebApp);
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    
    public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            lock (this)
            {
                try
                {
                    SPSecurity.RunWithElevatedPrivileges(delegate ()
                    {
                        SPWebApplication parentWebApp = (SPWebApplication)properties.Feature.Parent;
                        DeleteExistingJob(JobName, parentWebApp);
                    });
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
    

    如果这不是问题,并且您有一个功能事件接收器,请在此处共享 cs 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多