question

FerencSzcsi-8317 avatar image
1 Vote"
FerencSzcsi-8317 asked FerencSzcsi-8317 commented

Is there a way to limit Azure App Service startup attempts

Hi,

I am deploying and swapping my Azure App Service via AzDo tasks. Sometimes, when there's an issue with the application itself, swapping will fail with:
Error: Failed to swap App Service 'myservice' slots - 'staging' and 'production'. Error: ExpectationFailed - Cannot swap site slots for site 'myservice' because the 'staging' slot did not respond to http ping. (CODE: 417)
Which is fine, my app cannot start up correctly because of configuration issues.

My question here is if there's a setting either in the AzDo task or in Azure itself to maximize the number of app startup attempts, because we need to wait more than 20 minutes for the AzDo task to fail at the moment, which is a bit too long.

Thanks,
Ferenc

azure-webapps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Grmacjon-MSFT avatar image
0 Votes"
Grmacjon-MSFT answered FerencSzcsi-8317 commented

Hi @FerencSzcsi-8317,

Apologizes for the delay in response. Do you have auto swap enabled?

Auto swap streamlines Azure DevOps scenarios where you want to deploy your app continuously with zero cold starts and zero downtime for customers of the app. When auto swap is enabled from a slot into production, every time you push your code changes to that slot, App Service automatically swaps the app into production after it's warmed up in the source slot.

Please keep in mind that some apps might require custom warm-up actions before the swap. The applicationInitialization configuration element in web.config lets you specify custom initialization actions. The swap operation waits for this custom warm-up to finish before swapping with the target slot. Here's a sample web.config fragment.

 <system.webServer>
     <applicationInitialization>
         <add initializationPage="/" hostName="[app hostname]" />
         <add initializationPage="/Home/About" hostName="[app hostname]" />
     </applicationInitialization>
 </system.webServer>

You can also customize the warm-up behavior with one or both of the following app settings:

WEBSITE_SWAP_WARMUP_PING_PATH: The path to ping to warm up your site. Add this app setting by specifying a custom path that begins with a slash as the value. An example is /`statuscheck`. The default value is /.
WEBSITE_SWAP_WARMUP_PING_STATUSES: Valid HTTP response codes for the warm-up operation. Add this app setting with a comma-separated list of HTTP codes. An example is 200,202 . If the returned status code isn't in the list, the warmup and swap operations are stopped. By default, all response codes are valid.
WEBSITE_WARMUP_PATH: A relative path on the site that should be pinged whenever the site restarts (not only during slot swaps). Example values include /`statuscheck` or the root path, /.


For more insight on troubleshooting Swap operations please read this blog post.

Hope that helps. Let us know if you have further questions.

Thanks,
Grace



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Grmacjon-MSFT,

Thanks for your response.
Since my app has configuration issues swap fails (it doesn't matter if it's regular or auto swap). During a swap my app in the slot needs to be started first, but that's never going to happen because of aforementioned coniguration issues.

My original question was about limiting the startup attempts of an app, as the AzDo task last for more than 20 minutes. Basically, I want it to fail after the first startup attempt, when my app has config issues.

Regards,
Ferenc

0 Votes 0 ·