{"id":11823,"date":"2020-12-30T09:52:17","date_gmt":"2020-12-30T09:52:17","guid":{"rendered":"https:\/\/www.itwriting.com\/blog\/?p=11823"},"modified":"2020-12-30T13:00:00","modified_gmt":"2020-12-30T13:00:00","slug":"odd-behaviour-from-azure-app-service-production-version-sometimes-serves-app-from-staging-slot","status":"publish","type":"post","link":"https:\/\/www.itwriting.com\/blog\/11823-odd-behaviour-from-azure-app-service-production-version-sometimes-serves-app-from-staging-slot.html","title":{"rendered":"Odd behaviour from Azure App Service: production version sometimes serves app from staging slot"},"content":{"rendered":"<p>I am developing an application which is deployed to Azure App Service. It runs on .NET 5.0 on Linux. I have set up a simple DevOps process so that committing changes to GitHub runs an Azure DevOps pipeline that deploys the application to a staging slot on Azure App Service for Linux. Then I can use Swap in the Azure portal to update the production slot. Swap simply exchanges the content of the staging slot with that in the production slot, so there is a route back in the event of disaster. Swap also restarts the application and forces users to log back in.<\/p>\n<p>Yesterday I fixed a bug, deployed the change to the staging slot, and performed a swap. Logged back into the application, but the bug was still there, though intermittent. That was the bit I could not figure out: what was causing the code to behave differently on different requests? I became suspicious that it was sometimes serving the old version. I proved this by refreshing a page that demonstrated the bug. My page has an application version in the footer, and I could see that when the bug appeared, the version was older.<\/p>\n<p><a href=\"https:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2020\/12\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"244\" height=\"76\" title=\"image\" style=\"margin: 0px; display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2020\/12\/image_thumb-3.png\" border=\"0\"><\/a><\/p>\n<p><a href=\"https:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2020\/12\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"244\" height=\"77\" title=\"image\" style=\"margin: 0px; display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2020\/12\/image_thumb-4.png\" border=\"0\"><\/a><\/p>\n<p>Well this is odd. In the App Service Deployment slot settings I have traffic set to 100% for the production slot:<\/p>\n<p><a href=\"https:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2020\/12\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"244\" height=\"166\" title=\"image\" style=\"margin: 0px; display: inline; background-image: none;\" alt=\"image\" src=\"https:\/\/www.itwriting.com\/blog\/wp-content\/uploads\/2020\/12\/image_thumb-5.png\" border=\"0\"><\/a><\/p>\n<p>In general I tend to assume a bug in my code or an error in my configuration settings is more likely than an issue with the Azure App Service. This does look odd though: why, if traffic is going 100% to the production slot, does the application sometimes serve the old version?<\/p>\n<p>The pragmatic fix was easy. A second deployment to the staging slot means both now have code that works. The bug no longer appears; but I have kept the version number different and can see that the issue is actually still occurring.<\/p>\n<p>I will update this post when I have more information, just in case anyone else hits this issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am developing an application which is deployed to Azure App Service. It runs on .NET 5.0 on Linux. I have set up a simple DevOps process so that committing changes to GitHub runs an Azure DevOps pipeline that deploys the application to a staging slot on Azure App Service for Linux. Then I can &hellip; <a href=\"https:\/\/www.itwriting.com\/blog\/11823-odd-behaviour-from-azure-app-service-production-version-sometimes-serves-app-from-staging-slot.html\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Odd behaviour from Azure App Service: production version sometimes serves app from staging slot<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,19,60,1519],"tags":[],"class_list":["post-11823","post","type-post","status-publish","format-standard","hentry","category-net","category-cloud-computing","category-notes-from-the-field","category-tech"],"_links":{"self":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/11823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/comments?post=11823"}],"version-history":[{"count":4,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/11823\/revisions"}],"predecessor-version":[{"id":11827,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/posts\/11823\/revisions\/11827"}],"wp:attachment":[{"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/media?parent=11823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/categories?post=11823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itwriting.com\/blog\/wp-json\/wp\/v2\/tags?post=11823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}