Search code examples
azureazure-web-app-serviceazure-vm

How can I set the website within this IIS within the Azure VM to be always on?


I have a website hosted on IIS on Azure Virtual Machine. After no activity for 1 hr, the first page loads very slowly however subsequent pages are loaded fast.

I beleive this is a cold start issue where if a website is not visited in the last 1 hour or so, the VM sets the website to a cold state. If I hit the website again after 1 hour, the first page load will be very slow.

I need information on how I can set the website within this IIS within the Azure VM to be always on so that it is always responding quickly on initial load (even if there was no activity for 1 hour or more).


Solution

  • Firstly, set up IIS on Windows Virtual Machine to add the feature of IIS manager.

    Secondly, set IIS to keep website alive. The Application Initialization Feature can be installed as part of IIS features.

    enter image description here

    Thirdly, enabled Website or Application Preload.

    enter image description here

    And set Application Pool Start Mode: AlwaysRunning.

    enter image description here

    For more details, you could refer to this article.