Azure WebApp – Slot Traffic % Not Working

huangapple go评论59阅读模式
英文:

Azure WebApp - Slot Traffic % Not Working

问题

我有一个Azure Web应用(ASP Core MVC),通常使用2个部署槽:

  • 生产
  • 部署

我将代码部署到"部署"槽,测试确保一切正常运行,然后与"生产"槽进行交换。在交换过程中会有1-2分钟的停机时间,除此之外没有其他问题。

但是,我现在有一个新的功能要测试,我想要将一定百分比的流量分配给它。所以我添加了一个名为"测试生产"的槽。我将新功能部署到了这个槽,并在"部署槽"屏幕上分配了50%的流量给这个槽。

然而,我似乎无法让任何流量进入该槽。至少从我的计算机/平板电脑上看,所有流量似乎都进入了常规的"生产"槽。我将"测试生产"的流量提高到了95%,但仍然看到"生产"槽的代码。我是否遗漏了其他需要做的事情,以便将一些流量测试到"测试生产"槽?

谢谢!

英文:

I have an Azure webapp (ASP Core MVC) and normally use 2 slots:

  • Production
  • Staging

I deploy to Staging, test to make sure things are running properly, and swap with Production. No problems except for the 1-2 min downtime during swap.

However, I have a new piece of functionality that I want to test out with a certain % of traffic. So I added a slot called "TestProduction". I deployed the new functionality to that slot and allocated 50% of my traffic to that slot (in Deployment Slots screen).

However, I can't seem to get any traffic to go there. At least traffic from my computer/tablet all seems to go to the regular Production slot. I bumped TestProduction all the way up to 95% and still I'm seeing the Production slot code. Is there something else I'm missing here to test out some traffic to the TestProduction slot?

Thx!

答案1

得分: 2

Step 1: 在我的实验环境中尝试重现相同的情况,并在按照以下步骤后获得了积极的结果。

Step 2: 创建一个 Azure Web 应用服务,其中包括两个部署插槽。

现在,每当我尝试通过浏览器访问网页时,我只会看到特定插槽中的代码。原因是,当我们首次访问网页时,它会在浏览器中存储 cookie。有关更多信息,请参考此链接。

因此,为了测试这些插槽,请在浏览器中打开隐私模式或无痕模式,然后输入 URL。您必须为每个新的访问都执行此操作。

英文:

I have tried to repro the same in my lab environment and got positive results after following the below steps.

Step 1: Create an azure webapp service with two deployment slots.

Azure WebApp – Slot Traffic % Not Working

Step 2: Deploy two different codes into the slots.

Now whenever I tried to access the webpage through the browser, I used to see the code only in the specific slot. The reason is when we accessed the web page for the first time it will store cookies on the browser. Refer to this link for more information.

Azure WebApp – Slot Traffic % Not Working

So, to test the slots, open the browser in private mode or incognito mode and enter the URL. You must do this for every new hit.

Azure WebApp – Slot Traffic % Not Working

huangapple
  • 本文由 发表于 2023年2月14日 05:12:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/75441234.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定