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
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.
官方文档
https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots解决方案
-
使用 Azure CLI 将所有槽位特定设置标记为“部署槽位设置”:az webapp config appsettings set --resource-group myRG --name myApp --slot-settings KEY=VALUE
-
在交换前临时从源槽位中移除所有槽位特定设置,交换后重新应用。
-
使用 Azure DevOps 的“Azure App Service 管理”任务并选择“预览交换”选项,在完全交换前验证设置。
无效尝试
常见但无效的做法:
-
70% 失败
Recreating the slot does not resolve the underlying sticky settings conflict; the new slot inherits the same configuration unless manually changed.
-
90% 失败
The portal enforces the same sticky setting rules; manual swap will fail with the same error if sticky settings are misconfigured.
-
95% 失败
Restarting does not affect slot swap logic or configuration settings.