生产槽在源槽列表中缺失 – Azure 交换

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

Production slot is missing in source slots list - Azure swap

问题

我有2个Azure Web应用的部署槽:生产和暂存。我将代码部署到暂存槽,然后与生产槽交换,一切都没有问题。现在我想要再次交换回来:选择生产槽作为源槽,暂存槽作为目标槽,但源槽列表中只有“Stating”槽,所以无法选择生产槽作为源槽。尝试使用Azure CLI,收到了“ResourceNotFound”错误,指的是找不到生产槽。可能出现了什么问题?

英文:

I have 2 deployment slots in Azure Web App: production and staging. I deployed code to Staging slot and then swapped with Production slot without any problem. Now I'm trying to swap back: choose Production slot as source and Staging slot as target, but there is only Stating slot in source slots list, so cannot choose Production slot as source slot. Tried via Azure CLI and got error back ResourceNotFound for Production slot. What can be the problem?

答案1

得分: 0

要将先前的版本切换到生产环境,您可以选择将暂存环境作为源,将生产环境作为目标。这两者会发生互换。

假设您在生产环境中有版本1(v1),在暂存环境中有版本2(v2)。
您将暂存环境切换到生产环境。
现在v2位于生产环境,v1位于暂存环境。
因此,再次执行相同的切换操作会导致v1位于生产环境,v2位于暂存环境。

需要注意的一点是,生产环境在技术上不是一个插槽(slot),它是主要的应用服务。这可能是为什么会出现资源未找到的情况。与将一个插槽与另一个插槽互换不同,使用生产环境进行切换实际上是一项与之分开的操作。具体信息请参考:https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/swap-slot-with-production。

英文:

To swap the previous version to Production, you can choose Staging as source and Production as target.
The two are swapped as a result.

Let's say you had v1 in Production and v2 in Staging.
You swapped Staging to Production.
Now v2 is in Production and v1 in Staging.
So doing the same swap again results in v1 in Production and v2 in Staging.

One thing to note is that Production is technically not a slot, it is the main App Service. That could be why you get a resource not found. Swapping with Production is actually a separate operation from swapping some slot with another slot: https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/swap-slot-with-production.

答案2

得分: 0

  • 如果"Production"槽不出现在源槽列表中,当尝试通过Az CLI与"Production"槽交换时出现"ResourceNotFound"错误,可能是"Production"槽已被删除或不再可访问于您的Web应用程序。

要检查Web应用程序的可用槽位,您可以使用AzCLI命令。

az webapp deployment slot list --name <webapp> --resource-group <resourcegroupname>

输出:

生产槽在源槽列表中缺失 – Azure 交换

  • 有时候,您可以在"暂存"和"生产"槽位之间进行交换,选择将目标设置为"生产",但反之则不适用于一些应用服务,详情请参见MSDoc

以下是我的"部署槽位",它们位于应用服务的部署下,您可以检查"状态"以查看是否正在运行。

您还可以检查您的应用服务的"活动日志",以查找部署槽位的日志历史和应用服务/ Web应用程序的相关信息。

生产槽在源槽列表中缺失 – Azure 交换

如果问题仍然存在,我建议您创建一个新的生产槽位,然后在其中部署您的代码,以避免这些冲突。

英文:
  • If the Production slot does not appear in the list of source slots and you receive a "ResourceNotFound" error when trying to swap with the Production slot either through Az CLI, the Production slot may have been deleted or it's no longer accessible in your Web App.

To check the available slots for a webapp, you can use AzCLI command.

az webapp deployment slot list --name &lt;webapp&gt; --resource-group &lt;resourcegroupname&gt;

Output:

生产槽在源槽列表中缺失 – Azure 交换

  • And sometimes, you can swap between staging and production slots by choosing to target as a production but vice versa is not doable for few app services as detailed in MSDoc.

And below are my deployment slots which are available under deployments of an App service and you can check the status to see if it is running.

You can also check the activity log of your app service to find the log history of deployment slots and the relevant information of an App Service/Webapp.

生产槽在源槽列表中缺失 – Azure 交换

If still the issue persists, I suggest you create one new production slot and then deploy your code in it to avoid these conflicts.

huangapple
  • 本文由 发表于 2023年2月27日 10:55:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75576411.html
匿名

发表评论

匿名网友

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

确定