Azure Web App equivalent of IIS IdleTimeout - azure

I've got an ASP.NET MVC site hosted as an Azure Web App and I've noticed that once the site has been idle for a while, when hitting it the application reverts to a deployed state.
Now traditionally, I would solve this problem by setting the Idle Timeout of the application pool in IIS to 0. However, given that I don't have ready access to do this with an Azure Web App I'm struggling to find the equivalent.
I did try the "Always On" setting which appears to be what I'm looking for, however it seemed to make absolutely no difference unfortunately.

Always On. By default, web apps are unloaded if they are idle for some
period of time. This lets the system conserve resources. In Basic or
Standard mode, you can enable Always On to keep the app loaded all the
time. If your app runs continuous web jobs, you should enable Always
On, or the web jobs may not run reliably.
From https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-configure
Make sure you're running in the right price tier (Basic / Standard).

Related

How to configure warm-up of web-service application within Microsoft Azure

On IIS I can configure my web-service with Application Initialization, AlwaysRunning and Preload enabled to make sure the first request is fast enough. Now I am trying to create a similar web-service within Microsoft Azure. However, the first request is exteremely slow. I tried to speed it up using "Always on", but this doesn't work. What configuration is needed to make sure the warm-up works correctly in Azure?
I would like to make Azure react the same way as IIS when restarting the application or refreshing the web.config. Besides the "Always on" functionality, I can't find the settings that are needed to do this. I have searched on other pages, but most solutions are about the warm-up of a website page. Is there a (simple) configuration to use for the warm-up of a web-service within an Azure app service?
Have you enabled Preload?
When you create the Web Service Application in azure...
Under Settings, Configuration, Path Mappings..

Setting node.js site to auto-start when hosted in Azure Web app

I have a Node.js script that I want to run in Azure on a Web app.
This script is not an express web site, rather it's a worker script which polls a database for work to perform, and when done it just polls and waits, e.g. there is not user interface for it.
I notice that after deploying it, even though it's setup with iisnode, it won't actually start until I fire up a browser and navigate to the Azure Web app host, even though it doesn't have a UI.
Only when I navigate to it does iisnode start logging and fire up my application. Then it happily polls the database and performs the required work.
Does anyone know how you can make a site just automatically start when deployed?
There seem to be autostart web.config settings available with IIS, but I don't know how to get iisnode or the Azure Web app to support it.
I could set up a Web job on the machine that just performs a GET from the site, but that seems a bit of overkill and messy.
You can leverage Function App to satisfy your requirement. Also, your original solution which build an Azure Web App without UI should be work.
However, please pay attention that Azure App Services will be unloaded after they have been idle. You can enable the Always on application setting to keep the app loaded all the time. Please refer to https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/#application-settings for more details.
Any further concern, please feel free to let me know.

Microsoft Azure free website issue (NodeJS server)

I have a NodeJS server running on an Azure free website. The server has a websocket module installed. Each connected user will cache some data with an object so that anyone else who connects can retrieve cached data from this object. The problem I am experiencing is that the server doesn't seem to keep this object around for very long. I can access the data with in for some time, but if I try later in the day, it's just gone.
Is Azure shutting down the server because it is experiencing no activity, causing the object to be deallocated? Does NodeJS deallocate objects if they aren't used after some time?
Azure Websites, as Ben pointed out in his answer, will evict idle websites. This is especially true with free/shared tiers, since your website is sharing resources with several other tenants on the same VM instances. But even with basic and standard tiers, there may be a need to evict your website (especially since you can have many of your own websites running within a single hosting plan).
With basic/standard tier websites, you have the ability to enable Always On. You'll see this option under the Configure tab:
Once you enable this, your website should remain loaded.
Yep. If there aren't any requests to the app pool, Azure Websites stops your application. That means anything in memory is lost. You can set up a cron job or scheduled task to ping your web app to avoid the app pool timing out due to inactivity.
EDIT: Or, as David Makogon pointed out,
With basic/standard tier websites, you have the ability to enable Always On. You'll see this option under the Configure tab:

Will "Always On" setting prevent BOTH idleTimeout and periodicRestart?

Has you may know, Web sites hosted under Microsoft Azure Web Sites service are by default configure to timeout after idling 20 minutes (idleTimeout) and the application pool to restart every 29 hours (periodicRestart). This cause the web site to be slow for the first user accessing it.
I would like to know if the new "Always On" setting available on standard mode will prevent both situation from happening.
I found a few articles mentioning the feature, they are all very clear that the idle timeout will be avoided but none of them explicitly talks about the periodic restart:
One of the other useful Web Site features that we are introducing
today is a feature we call “Always On”. When Always On is enabled on
a site, Windows Azure will automatically ping your Web Site regularly
to ensure that the Web Site is always active and in a warm/running
state. This is useful to ensure that a site is always responsive (and
that the app domain or worker process has not paged out due to lack of
external HTTP requests).
http://weblogs.asp.net/scottgu/archive/2014/01/16/windows-azure-staging-publishing-support-for-web-sites-monitoring-improvements-hyper-v-recovery-manager-ga-and-pci-compliance.aspx
Also the Azure Documentation is not very explicit:
Always On - By default, web sites are unloaded if they have been idle
for some period of time. This lets the system conserve resources. You
can enable the Always On setting for a site in Standard mode if the
site needs to be loaded all the time. Because continuous web jobs may
not run reliably if Always On is disabled, you should enable Always On
when you have continuous web jobs running on the site.
http://www.windowsazure.com/en-us/documentation/articles/web-sites-configure/
Yes both of them will be prevented.
The default 29 hours periodicRestart was never on Azure Websites. That feature is an IIS feature that was enforced by WAS and was designed to run on a server level meaning restart all the worker processes on an IIS server. Both these things (WAS and IIS Server) don't apply to Azure Websites as WAS was the process management component of IIS and that was very specific to one box setup. Azure Websites uses a different process management component that doesn't have periodicRestart.

Automatic Browse Service.svc file in iis

I have created a WCF service which i have hosted in IIS. When I start the service in IIS, the Service do not started until I browse my Service.svc file.
Application pool gets recycled after a specific interval, then when the Service is restarted I again need to go and browse the Service.svc file.
I have set this Service as Default bt it does not work and results the same.
Is there any way to automatic browse my Service.svc file when the Service is started or restarted.
This is a general annoyance with IIS. It launches worker processes to perform website processing which don't (always) start until the website has been requested. The workaround I've used in the past is to hit a page outside of my web application to launch the IIS worker process so it is available when I need it. Be careful though there are some nuances to the app pools that can make this more complicated than it needs to be.

Resources