I deployed an ASP.NET 5, MVC 6 web application to Azure. It seems that if I don't hit the site for 10-15 minutes, it goes to sleep and it takes a good 10-15 seconds for it to wake up.
I am not sure whether its the website that's falling asleep, or the database that it's connecting to.
So 2 questions.
- How do I prevent the site from going to sleep so soon.
- Is there a way to have visibility into what's going on in Azure with the website and the database. Are they kicked out of memory?
I know this post is a little old, but the issue is still relevant.
I use a free service called Uptime Robot - https://uptimerobot.com/
Even on the free tier, you can create up to 50 monitors to call your web site, at least every 5 minutes, which is certainly regularly enough to keep your site alive.
As well as keeping the site alive (without any knock-on consequences of using 'Always On') it also serves as a monitor for your site, letting you know if it's down.
You can create monitors that alert you if specific words are in or not in the response, so it's quite easy to check the content is correct. You could even create a 'test' page that just returns 'OK' after checking various functionality on your site.
来源:https://stackoverflow.com/questions/33789895/how-to-prevent-an-azure-website-from-going-to-sleep