Azure deployments – Slot swapping failed to apply changes to all instances of scaled up AppService

Our team have came across with 404 responses while running integration tests after a fresh deployment of our API I have been investigating it and I have found following issues.

I used fiddler to query the endpoint and could reproduce the bug, below are the responses Fiddler Request

GET HTTP/1.1 Host: Authorization: bearer {token} Cache-Control: no-cache Success

HTTP/1.1 200 OK Content-Type: application/json Server: Microsoft-IIS/8.0 X-Powered-By: ASP.NET Set-Cookie: ARRAffinity=a848697635096fe43d824473381245e6c5b2500699b8216381412588e39c629b;Path=/; Date: Wed, 29 Mar 2017 10:49:38 GMT Content-Length: 161

{Valid JSON Response} Failed

HTTP/1.1 404 Not Found Content-Length: 103 Content-Type: text/html Server: Microsoft-IIS/8.0 X-Powered-By: ASP.NET Set-Cookie: ARRAffinity=ddce0ce0360a57c79d2e3292cc6991ebfca9940eff307fbc2b4998e9e783aa3a;Path=/; Date: Wed, 29 Mar 2017 10:49:36 GMT

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

As you can see, the requests that are failing are hitting another instance that does not have any running apps or some old obsolete version.

I have manually restarted the AppService instance and everything came back to normal.

My deployment steps are :

Create a Staging slot using Azure SDK function: New-AzureRmWebAppSlot -ResourceGroupName $resourceGroupName -Name $webAppName -Slot $deploymentSlot -AppServicePlan $appServicePlan.Id Deploy a artifact zip file using VSTS Task (it is using MSDeploy): AzureAppServiceDeploy – with Deploy to slot ticked and Slot = Staging Swap and delete Staging slot using Azure SDK Functions: Invoke-AzureRmResourceAction -ResourceGroupName $resourceGroupName -ResourceType “Microsoft.Web/sites/slots” -ResourceName “$($webAppName)/$($stagingSlotName)” -Action slotsswap -Parameters $ParametersObject -ApiVersion $apiVersion -Force Remove-AzureRmResource -ResourceGroupName $resourceGroupName -ResourceType “Microsoft.Web/sites/slots” -Name “$($webAppName)/$($stagingSlotName)” -ApiVersion $apiVersion -Force In order to fix this I have to do a post deployment service restart. or use MSDeploy and enable “Take application offline” whoever that will land me into a different intermittent Connection Terminated problem .

submitted by /u/p0d0s
[link] [comments]

Leave a Reply