Dot Freelancer
Dot Freelancer

Reputation: 4253

can't use Hangfire with ASP.NET webforms Website

I have created empty asp.net webforms website using Visual studio 2013 from File > new > Website (not project ) and installed Hangfire library. then i have added Startup.cs File in App_code and root folder. then i have created simple test in 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 create a project and do the same steps, it runs without any problem, anyone can help ?

Upvotes: 3

Views: 4582

Answers (2)

hubert.hu
hubert.hu

Reputation: 1

hello i have you some problem

so. you must remove this config

   <add key="owin:AppStartup" value="false" />

<add key="owin:AutomaticAppStartup" value="false" />

Upvotes: 0

Dot Freelancer
Dot Freelancer

Reputation: 4253

I moved this line

Hangfire.RecurringJob.AddOrUpdate(() => Console.WriteLine("I am done, wasim!"), Hangfire.Cron.Minutely);

from Application_Start, i think he was calling it early, so i moved it to .aspx page.. and everything works well now!

Upvotes: 3

Related Questions