I want to deploy a simple shared-host ASP.NET MVC site to Azure (using the free site option) which uses Hangfire to run scheduled tasks.
Problem is the site only starts on the first request, and so Hangfire doesn't start scheduling tasks until then. With IIS or a dedicated VM, you can set the "always on" option to prewarm the site. But this is not possible in shared hosting.
What can I do about this? I thought of paying for the smallest VM, called "A0", and putting a ping script on there to ensure my site is always up. That would work, but seems like overkill.
Are there any other good options?
Old question I know, but maybe I am missing something. I use UptimeRobot (https://uptimerobot.com/) as it continually makes request to your web server to keep it alive. Wouldn't that be much simpler than creating an automated job on your own. Again, I'm not sure if being on a shared environment would render UptimeRobot useless, but just a thought I wanted to pass along.
If you still would like to use azure website you have to switch from SHARED to BASIC (that's the first one with ALWAYS ON option), but it's more than 3 times more expensive than the cheapest VM.
If I were you I would go for cheapest Cloud Service - Web Role. It cost a bit more than the cheapest VM but it's already configured for web sites and you don't have to set up everything on your own + you can use Visual Studio to deploy it, you can RDP to the box and many many more.
See http://azure.microsoft.com/en-us/pricing/details/cloud-services/ for pricing details.
But as suggested in comments Azure Schedule is something worth looking at.
UPDATE: (WARNING - interesting but completely not serious solution)
Use Azure Scheduler to ping you web page to keep it alive ;-) You can create up to 5 jobs with maximum execution every hour with FREE tier. Which means that you can create 5 jobs which will ping you website every 12 minutes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With