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

Azure Pipelines发布构件报错:找不到指定服务的解决方案求助

Azure Pipelines 发布工件报错排查方案

问题背景

将在其他组织正常运行的Azure Pipelines YAML复制到新创建的组织项目后,执行upload步骤时出现服务未找到错误。尝试替换为PublishArtifact任务、更换工作目录均无效,错误核心信息如下:

##[error]Could not find service '2a313f99-f039-49a7-b2dd-792d5ddab990' from host'e66ad7ba-8f3a-416b-99f7-c791f17a2dce'. Please ensure the service is registered with the Shared Platform Service.

完整错误日志

Publish script

View raw log
Starting: Publish script
==============================================================================
Task         : Publish pipeline artifact
Description  : Publish a local directory or file as a named artifact for the current pipeline
Version      : 0.141.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact
==============================================================================
Uploading pipeline artifact from /home/vsts/work/1/a/120.zip for build #120
Using default max parallelism.
Max dedup parallelism: 192
ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 725a7bc3-3a45-460a-b17e-d831db7982ed
DedupManifestArtifactClient will correlate http requests with X-TFS-Session 725a7bc3-3a45-460a-b17e-d831db7982ed
1 files processed.
Processed 1 files from /home/vsts/work/1/a successfully.
Uploading 1 files from directory /home/vsts/work/1/a.
Uploaded 62,099,157 out of 99,088,314 bytes.
Uploaded 72,077,736 out of 99,088,493 bytes
Content upload is done!

Content upload statistics:
Total Content: 198.2 MB
Physical Content Uploaded: 64.0 MB
Logical Content Uploaded: 72.1 MB
Compression Saved: 8.1 MB
Deduplication Saved: 126.1 MB
Number of Chunks Uploaded: 904
Total Number of Chunks: 4,772

ApplicationInsightsTelemetrySender correlated 2 events with X-TFS-Session 725a7bc3-3a45-460a-b17e-d831db7982ed
##[error]Could not find service '2a313f99-f039-49a7-b2dd-792d5ddab990' from host'e66ad7ba-8f3a-416b-99f7-c791f17a2dce'. Please ensure the service is registered with the Shared Platform Service.
Finishing: Publish script

管道YAML代码

# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- main

pool:
  vmImage: ubuntu-latest

stages:
- stage: Build
  displayName: Build stage
  jobs:  
  - job: Build
    displayName: Build

    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '16.x'
      displayName: 'Install Node.js'

    - script: |
        npm install
        npm run build --if-present
        npm run test --if-present
      displayName: 'npm install, build and test'
    
    - task: ArchiveFiles@2
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
        includeRootFolder: false
        archiveType: 'zip'
        archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
        replaceExistingArchive: true
    
    - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
      displayName: 'Publish'
      artifact: drop

- stage: Deploy
  displayName: Deploy stage
  dependsOn: Build
  condition: succeeded()
  jobs:
  - deployment: Deploy
    displayName: Deploy
    environment: test-env
    strategy:
      runOnce:
        deploy:
          steps:            
          - task: AzureWebApp@1
            displayName: 'Azure Web App Deploy: narwhal-web-strapi'
            inputs:
              azureSubscription: 'XXXX'
              appType: 'webAppLinux'
              appName: 'XXXXX'
              package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
              runtimeStack: 'NODE|16-lts'
              startUpCommand: 'npm run start'

补充信息

  • 管道在其他组织运行正常
  • 新组织已配置计费,拥有1个并行托管代理

排查解决方案

  1. 检查组织级服务注册状态
    该错误源于新组织的Shared Platform Service未注册目标服务,请联系Azure DevOps组织管理员,确认组织后台服务初始化完成,尤其是工件相关的服务组件已正常注册。

  2. 升级Publish Pipeline Artifact任务版本
    当前使用的任务版本为0.141.0,属于旧版本,存在与新组织环境的兼容问题。在管道编辑器中,将Publish pipeline artifact任务切换到最新版本后重新运行。

  3. 重新创建管道而非直接复制YAML
    避免直接复制旧组织的YAML文件,在新组织中从头创建Node.js类型的管道,逐步添加原有步骤配置,消除旧组织隐含的配置残留。

  4. 验证托管代理与环境配置

    • 切换vmImage版本(如替换为ubuntu-22.04)测试,排除旧镜像环境的兼容性问题
    • 确认组织的并行托管代理已正常启用,尝试重启代理服务
  5. 检查工件存储配置
    进入组织设置的“工件”选项,确认工件存储账户状态正常,无权限或初始化异常。


内容的提问来源于stack exchange,提问作者walrusdev

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 13:17:17