How do I run Hangfire (Always On) on Azure Shared Hosting?

I want to deploy a simple ASP.NET MVC shared host site on Azure (using the free site option) that uses Hangfire to perform scheduled tasks.

The problem is that the site only starts on the first request and therefore Hangfire doesn't start scheduling tasks until then . With IIS or a dedicated virtual machine, you can set the "always on" option to preheat the site. But this is not possible in shared hosting mode.

What can I do about this? I thought about paying for the smallest virtual machine called "A0" and putting a ping script there so my site is always at the top. It will work, but it looks like it's overkill.

Are there any other good options?

+3


source to share


2 answers


If you still want to use an azure website, you need to switch from SHARED to BASIC (this is the first option with ALWAYS ON), but it is more than 3x more expensive than the cheapest VM.

If I were you, I would go for the cheapest Cloud Service - Web Role. It cost a little more than the cheapest virtual machine, but it's already set up for websites and you don't need to configure everything yourself + you can use Visual Studio to deploy it, you can use RDP and more.

For pricing details see http://azure.microsoft.com/en-us/pricing/details/cloud-services/ .



But, as suggested in the comments, Azure Schedule is something to look out for.

UPDATE : (WARNING - interesting but not at all serious solution)

Use Azure Scheduler to send you a web page to save it ;-) You can create up to 5 jobs with maximum execution every hour with a FREE tier. This means that you can create 5 jobs that will check your site every 12 minutes.

+4


source


Old question that I know, but maybe I am missing something. I use UptimeRobot ( https://uptimerobot.com/ ) as it continually makes a request to your web server to keep it alive. Wouldn't that be much easier than creating an automatic job yourself. Again, I'm not sure if sharing the environment would make the UptimeRobot useless, just a thought I would like to convey.



+6


source







All Articles