I have a pipeline with an app service that fails to swap with the following error:
Warming-up slots
Swapping App Service 'xxxxxxxx' slots - 'staging' and 'production'
Successfully updated deployment History at https://xxxxxxxx-staging.scm.azurewebsites.net/api/deployments/338981663268841323
Successfully updated deployment History at https://xxxxxxxx.scm.azurewebsites.net/api/deployments/338981663268841323
##[error]Error: Failed to swap App Service 'xxxxxxxx' slots - 'staging' and 'production'. Error: BadRequest - Cannot swap slots for site 'xxxxxxxx' because the application initialization in 'staging' slot either took too long or failed. Please check AppInit module configuration or try using swap with preview if application initialization time is very long. (CODE: 400)
##[section]Finishing: Swap Slots
I checked the eventlog.xml file, and see this, which I do not quite understand:
<Event>
<System>
<Provider Name="Instrumentation Engine"/>
<EventID>1000</EventID>
<Level>1</Level>
<Task>0</Task>
<Keywords>Keywords</Keywords>
<TimeCreated SystemTime="2022-09-15T19:24:37Z"/>
<EventRecordID>1896924390</EventRecordID>
<Channel>Application</Channel>
<Computer>xxxxxxxxxxx</Computer>
<Security/>
</System>
<EventData>
<Data>IfFailRet(m_pAppDomainCollection->GetModuleInfoById(moduleId, &pModuleInfo)) failed in function MicrosoftInstrumentationEngine::CProfilerManager::ClearILTransformationStatus</Data>
</EventData>
</Event>
- The pipeline file is using task
AzureAppServiceManage@0
to do the swap, and auto-swap is disabled
- The web.config does not have an
applicationInitialization
section.
- The app service does have
WEBSITE_SWAP_WARMUP_PING_STATUSES=200,202
on both slots
- The app service does have
WEBSITE_ADD_SITENAME_BINDINGS_IN_APPHOST_CONFIG=1
on both slots
- The app service does have
HTTPS Only = off
on both slots
When I reran the pipeline with system diagnostics enabled, I did see this:
##[debug][GET]http://xxxxxxx-staging.azurewebsites.net
##[debug]Could not parse response: {}
##[debug]Response: undefined
##[debug]App Service status Code: '403'. Status Message: 'Ip Forbidden'
##[debug]App Service status Code: '307'. Status Message: 'Temporary Redirect'
Swapping App Service 'xxxxxxx' slots - 'staging' and 'production'
##[debug][POST]https://management.azure.com/subscriptions/abcdefg/resourceGroups/rg1/providers/Microsoft.Web/sites/xxxxxxx/slots/staging/slotsswap?api-version=2016-08-01
##[debug]Correlation ID from ARM api call response : 9ef48c6c-b6ff-44a9-9154-c55b9990b088
##[debug]https://management.azure.com/subscriptions/abcdefg/resourceGroups/rg1/providers/Microsoft.Web/sites/xxxxxxx/slots/staging/slotsswap?api-version=2016-08-01 ==> undefined
##[debug][GET]https://management.azure.com/subscriptions/abcdefg/resourceGroups/rg1/providers/Microsoft.Web/sites/xxxxxxx/slots/staging/operationresults/667d3675-3bb8-4964-8a9c-fe6fd7198795?api-version=2016- 1-Aug
##[debug]Correlation ID from ARM api call response : 669cb941-f72c-4c76-82b1-299cf3ac1779
##[debug]https://management.azure.com/subscriptions/abcdefg/resourceGroups/rg1/providers/Microsoft.Web/sites/xxxxxxx/slots/staging/operationresults/667d3675-3bb8-4964-8a9c-fe6fd7198795?api-version=2016-08-01 ==> undefined
##[debug]Response status code : 202
##[debug][GET]https://management.azure.com/subscriptions/abcdefg/resourceGroups/rg1/providers/Microsoft.Web/sites/xxxxxxx/slots/staging/operationresults/667d3675-3bb8-4964-8a9c-fe6fd7198795?api-version=2016- 1-Aug
##[debug]Correlation ID from ARM api call response : b6ac6812-404b-4449-803e-a964b392078b
##[debug]Response status code : 400
##[debug]Completed action
The troubleshooting documentation says to look at eventlog.xml file, but didn't find anything helpful, and there wasn't anything in the link that looked like could be the culprit.
However according to the system diagnostics, I do see this, but not sure if this is the culprit, or how to resolve it.
##[debug]App Service status Code: '403'. Status Message: 'Ip Forbidden'
##[debug]App Service status Code: '307'. Status Message: 'Temporary Redirect'
Any ideas?