string strMsgID = //task1 returns a value; BackgroundJob.Enqueue(() => doLongJob(strMsgID)); public void doLongJob(string strMsgID) { int status = //task2(strMsgID); while( status == 2) { Thread.Sleep(10000); status = //task2(strMsgID); } } }
using Hangfire; using Microsoft.Owin; using Owin; [assembly: OwinStartup(typeof(erp.Startup))] namespace erp { public class Startup { public void Configuration(IAppBuilder app) { app.UseHangfireDashboard(); app.UseHangfireServer(); } } }
protected void Application_Start(object sender, EventArgs e) { GlobalConfiguration.Configuration.UseStorage(new MySqlStorage("hangfire")); }
doLongJob()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)