Recurring jobs not triggered

My jobs only fire when the web application is accessed, why?

Hi there,

Sounds like your application may need a keep a like job running, this page in the documentation covers some of it.

Also set up a recurring job to run every minute, try using using simple API call to your application if you have any.

Thanks for the prompt response…i already have the job as a recurring task through the API but is the proposed solution the same as constantly pinging the server as i had also tried that route. It however caused by application pool to go down time and time again?

I mean an extra job in Hangfire which would keep your application from stopping, essentially “pinging” your application.

RecurringJob.AddOrUpdate("keepAlive", () => CallRemoteService(string.Format("{0}{1}", ConfigurationManager.AppSettings["ApplicationUrl"].ToString(), "api/isalive")), Cron.Minutely(0));

You still face the issue of IIS shutting down the app pool at times, it can either be after a fixed number of requests, memory usage, time interval or fixed times a day. And if nothing from “the outside” is making requests to the side, the app pool won’t start up again and no HangFire jobs will be running, not even the “keepAlive” ping job.

Using serviceAutoStartProviders as described in this article is the right approach since it will tell IIS to run the specified code again after the app pool has been restarted.

Guess you were right, my ping jobs/requests ended up in a queue when i accessed the application again. I’ve gone and implemented the serviceAutoStartProviders but get a Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’. Reason: Failed to open the explicitly specified database. [CLIENT: ] error now making the service unable