You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure DevOps部署FastAPI应用时出现409 Conflict部署失败错误求助

Azure DevOps部署FastAPI应用时出现409 Conflict部署失败错误求助

大家好,我这两天一直在尝试把我的FastAPI应用部署到Azure DevOps上。之前部署完全正常,但这次我没对管道做任何改动,却部署失败了,实在摸不着头绪,想请大家帮忙看看问题出在哪。

我的Pipeline配置如下:

trigger:
- main

variables:
  azureServiceConnectionId: service_connectionID
  webAppName: appname
  vmImageName: 'image'
  environmentName: 'env'
  projectRoot: $(System.DefaultWorkingDirectory)
  pythonVersion: '3.11'

stages:
- stage: Build
  displayName: Build stage
  jobs:
  - job: BuildJob
    pool:
      vmImage: $(vmImageName)
    steps:
    # Set up Python environment
    - task: UsePythonVersion@0
      inputs:
        versionSpec: '$(pythonVersion)'
      displayName: 'Use Python $(pythonVersion)'

    # Install dependencies
    - script: |
        python -m venv antenv
        source antenv/bin/activate
        python -m pip install --upgrade pip
        pip install setuptools wheel
        pip install -r requirements.txt
      workingDirectory: $(projectRoot)
      displayName: 'Install requirements'
      
    # Create deployment package
    - task: ArchiveFiles@2
      displayName: 'Archive files'
      inputs:
        rootFolderOrFile: '$(projectRoot)'
        includeRootFolder: false
        archiveType: zip
        archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
        replaceExistingArchive: true

    # Publish build artifacts
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'drop'
        publishLocation: 'Container'

- stage: Deploy
  displayName: 'Deploy Web App'
  dependsOn: Build
  condition: succeeded()
  jobs:
  - deployment: DeploymentJob
    environment: $(environmentName)
    pool:
      vmImage: $(vmImageName)
    strategy:
      runOnce:
        deploy:
          steps:
          # Deploy the web app
          - task: AzureWebApp@1
            displayName: 'Deploy Azure Web App'
            inputs:
              azureSubscription: $(azureServiceConnectionId)
              appType: 'webAppLinux'
              appName: $(webAppName)
              package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
              runtimeStack: 'PYTHON|3.11'
              startUpCommand: 'startup.txt'
              deploymentMethod: 'auto'

我的启动命令写在startup.txt里,内容是:

gunicorn -w 4 -k uvicorn.workers.UvicornWorker --timeout 600 -b 0.0.0.0:8000 app:app

部署时收到的错误信息如下:

##[error]Failed to deploy web package to App Service.
##[warning]Can't find loc string for key: KuduStackTraceURL
##[error]KuduStackTraceURL https://:@ai-commission-dsbfcbduhcb6gtfz.scm.eastus2-01.azurewebsites.net/api/vfs/LogFiles/kudu/trace
##[error]Error: Error: Failed to deploy web package to App Service. Conflict (CODE: 409)
##[warning]Error: Failed to update deployment history. Error: Bad Request (CODE: 400)

有没有遇到过类似问题的朋友?麻烦帮我分析下可能的原因,或者有什么排查方向可以推荐的?

备注:内容来源于stack exchange,提问作者Nisarg jadhav

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 14:49:32