# hangfire使用
using System;
using Hangfire;
using Hangfire.SqlServer;
using Hangfire.Storage.SQLite;
namespace ConsoleApplication2
{
class Program
{
static void Main()
{
GlobalConfiguration.Configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
.UseColouredConsoleLogProvider()
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseSQLiteStorage("Data Source=hangfire.db");
// 队列,执行一次
BackgroundJob.Enqueue(() => Console.WriteLine("Hello, world!"));
//
BackgroundJob.Schedule(
() => Console.WriteLine("Hello, world 10s"),
TimeSpan.FromSeconds(10));
RecurringJob.AddOrUpdate("easyjob", () => Console.Write("Easy!"), Cron.Minutely);
using (var server = new BackgroundJobServer())
{
Console.ReadLine();
}
}
}
}
标签:Console,hangfire,Hangfire,WriteLine,使用,using,Hello
From: https://www.cnblogs.com/zhuoss/p/17955154