Azure App Service provide feature to auto-heal your service whenever it detects anomaly with the service.
Auto-Healing allows you to restart, log or perform custom actions (action) whenever a certain criteria about your App Service is met (trigger), for example, recycle service when slow requests is detected.
You define these triggers and actions to determine what triggers / actions to take.
Azure Web Sites
Before it was renamed to Azure App Service, the service is called Azure Web Sites. To enable auto-heal in Azure Web Sites, you would have to add configuration in the
<requests count="100" timeInterval="00:05:00" />
<actions value="Recycle" />
To see different scenarios on how to use this, head over to this link. Some of the scenarios are:
- Recycle based on Request count (code example above).
- Recycle based on slow requests.
- Logging an event or recycle based on HTTP status code(s).
- Take custom actions or recycle / log event based on memory limit.
Azure App Service
In the new Azure App Service, however, auto-heal works little bit differently. Announced in September 2018 (https://azure.github.io/AppService/2018/09/10/Announcing-the-New-Auto-Healing-Experience-in-App-Service-Diagnostics.html), the auto-heal is now available through Azure Portal.
To get to Auto-Healing setting, go to Azure App Service > Diagnose and solve problems > Diagnostic Tools > Auto Healing.
Azure App Service offers two types of auto-heal. First is ProActive Auto-Healing which is enabled by default. And custom Auto-Healing.
You can turn off ProActive Auto-Healing under Azure Portal as well.
To add custom Auto-Healing setting, follow this link.
As the screenshot shows, the first tab (“Configure Mitigation Rules”) is the custom Auto-Healing settings. By default it’s turned off. The second tab (“ProActive Auto-Healing”) is ProActive Auto-Healing and it’s turned on by default.