0

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

工作清单

工作定义

4

1 回答 1

0

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

功能事件接收器 SP 计时器作业作业

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

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 文件。

于 2022-02-07T11:57:08.193 回答