The root of the problem is that the URL rewrite rule that you use to redirect http to https prevents AlwaysOn searches from reaching your Java application.
Fortunately, there is a solution.
Solution # 1: use the XDT transform
Use the following steps:
- Remove the rewrite rule from your web.config
- Instead, use the Kudu Console (or FTP, but it's harder) to create a file called
applicationHost.xdt in the site folder (i.e. d:\home\site\applicationHost.xdt ). Hint: you can enter touch applicationHost.xdt in the Kudu Console to create an empty file. - Edit this file and paste the found XDT file here in the section "Redirect HTTP traffic to https".
- Save the file and restart your site from the portal.
Note that AlwaysOn requests will still look like 301 in http logs, but everything will continue (i.e. Java will wake up).
Solution # 2: make changes directly to your web.config
Alternatively, if you do not want to use the XDT transform and want to save everything in your web.config, you can simply add the missing fragments. In particular, you will need two changes (corresponding to the XDT above):
Add this condition to the rewrite rule:
<add input="{WARMUP_REQUEST}" pattern="1" negate="true" />
Add this applicationInitialization section to system.webServer :
<applicationInitialization> <add initializationPage="/" /> </applicationInitialization>
But I propose the XDT approach, because it does not require complex changes and keeps these "dirty" things separate from your code base.
Original answer
The correct way to enable Always On is to set it to On on the Azure portal. WEBSITE_SCM_ALWAYS_ON_ENABLED not what you can install, but it is what Azure installs as a result of enabling Always On.
Once you enable Always On, the root of your site (i.e. / ) will hit every few minutes, which should support it.
If you need extra paths to hit, you can use applicationInitialization. More details here .
source share