Can't use Hangfire with ASP.NET websites
I created a blank asp.net website using Visual studio 2013 from File> new> Website (not project) and installed Hangfire library. then I added Startup.cs file to App_code and root folder. then I created a simple test in the Global.ascx file
void Application_Start(object sender, EventArgs e)
{
Hangfire.RecurringJob.AddOrUpdate(() => Console.WriteLine("I am done!"), Hangfire.Cron.Minutely);
}
when i try to run the website it returns
JobStorage.Current property value has not been initialized. You must set it before using Hangfire Client or Server API.
but if I build a project and follow the same steps, it works without issue, can anyone help?
+3
dotfreelancer
source
to share
2 answers
I have moved this line
Hangfire.RecurringJob.AddOrUpdate(() => Console.WriteLine("I am done, wasim!"), Hangfire.Cron.Minutely);
from Application_Start, I think he called him before, so I moved him to the .aspx page .. and now everything works well!
+3
dotfreelancer
source
to share
Hi, you have some problem.
So. you have to remove this config
<add key="owin:AppStartup" value="false" />
<add key="owin:AutomaticAppStartup" value="false" />
0
hubert.hu
source
to share