I have a Web Api service running in Cloud Services in Azure. I noticed like many have here that the first call to the service seems to take forever (almost 1 minute) and subsequent calls are normal. I looked around and came about a few resolutions, one being adding a startup script to the Role Startup of the Deployment
REM *** Prevent the IIS app pools from shutting down due to being idle.
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00
REM *** Prevent IIS app pool recycles from recycling on the default schedule of 1740 minutes (29 hours).
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.time:00:00:00
As well as setting the AppPool's Start Mode Property to AlwaysOn. After making these changes, I am still seeing latency issues when the Cloud Service is initially deployed and the web service is hit. So what could be going on here? Do I need to write a script to "warm up" the web service on startup of the Cloud Service?