简体   繁体   English

ASP.NET MVC Hangfire获取作业的详细信息

[英]ASP.NET MVC Hangfire Get Collection of Jobs with details

我在ASP.NET应用程序中使用Hangfire在后台执行methodos,但是我需要创建自己的进程监视器,因此需要获取(选择)作业集合,并按日期,状态等进行过滤。 。 我怎样才能做到这一点?

Use Hangfire JobStorage 使用Hangfire JobStorage

var recurringJobs = Hangfire.JobStorage.Current.GetConnection().GetRecurringJobs();

You can use this to return from a controller. 您可以使用它从控制器返回。

public ActionResult Index()
        {
            var recurringJobs = Hangfire.JobStorage.Current.GetConnection().GetRecurringJobs();
            return View(recurringJobs);
        }

Then create your view (Right Click on Index > Add View). 然后创建您的视图(右键单击索引>添加视图)。 This will show the list of views. 这将显示视图列表。

Now you can write your script to sort/filter. 现在,您可以编写脚本进行排序/过滤。

Did you try to get jobs from database? 您是否尝试过从数据库中获得工作? Hangfire can store them if you configure it in your Startup class. 如果在Startup类中进行配置,则Hang​​fire可以存储它们。

select * from [HangFire].[Job]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM