SlotSwapLocked cloud config_error ai_generated true

错误:部署槽位 'staging' 因“粘性”配置设置而被锁定,无法交换

Error: Deployment slot 'staging' is locked and cannot be swapped due to 'sticky' configuration settings

ID: cloud/azure-app-service-deployment-slot-sticky

其他格式: JSON · Markdown 中文 · English
90%修复率
82%置信度
1证据数
2025-01-20首次发现

版本兼容性

版本状态引入弃用备注
Azure App Service: Linux active
Runtime: .NET 8 active
Azure CLI: 2.60.0 active

根因分析

部署槽位具有未标记为槽位特定的粘性应用设置或连接字符串,导致交换失败,因为这些设置会随槽位移动。

English

The deployment slot has slot-specific (sticky) app settings or connection strings that are not marked as slot-specific, causing the swap to fail because the settings would move with the slot.

generic

官方文档

https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots

解决方案

  1. 使用 Azure CLI 将所有槽位特定设置标记为“部署槽位设置”:az webapp config appsettings set --resource-group myRG --name myApp --slot-settings KEY=VALUE
  2. 在交换前临时从源槽位中移除所有槽位特定设置,交换后重新应用。
  3. 使用 Azure DevOps 的“Azure App Service 管理”任务并选择“预览交换”选项,在完全交换前验证设置。

无效尝试

常见但无效的做法:

  1. 70% 失败

    Recreating the slot does not resolve the underlying sticky settings conflict; the new slot inherits the same configuration unless manually changed.

  2. 90% 失败

    The portal enforces the same sticky setting rules; manual swap will fail with the same error if sticky settings are misconfigured.

  3. 95% 失败

    Restarting does not affect slot swap logic or configuration settings.