azure - 由于 'Forbidden',无法上传 Windows dll(使用 PublishBuildArtifacts 到 Azure DevOps)

标签 azure azure-devops upload azure-pipelines

我有一个 Azure 构建管道,它使用我们公司网络中的专用构建计算机。作为管道的一部分,将创建一个 Windows dll 文件和一个 exe 文件。这两个文件都应使用 PublishBuildArtifacts@1 任务上传:

- task:  
  inputs:
    PathtoPublish: 'batchfiles/SSMD'
    ArtifactName: 'ssmd-$(SSMD_VERSION).0.$(Build.BuildId)-$(GIT_VERSION)'
    publishLocation: 'Container'

上传windows dll文件时出现以下错误:

Fail to upload 'C:\agent-azure-v2.174.1\_work\1\s\batchfiles\SSMD\SSMD-21.0.0.106.dll' due to 'Forbidden'.

exe文件的上传工作正常。

感谢您的帮助!

<小时/>

详细日志信息:

Starting: PublishBuildArtifacts
==============================================================================
Task         : Publish build artifacts
Description  : Publish build artifacts to Azure Pipelines or a Windows file share
Version      : 1.158.3
Author       : Microsoft Corporation
Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/publish-build-artifacts
==============================================================================
Async Command Start: Upload Artifact
Uploading 1 files
Total file: 1 ---- Processed file: 0 (0%)
Total file: 1 ---- Processed file: 0 (0%)
Fail to upload 'C:\agent-azure-v2.174.1\_work\1\s\batchfiles\SSMD\SSMD-21.0.0.106.dll' due to 'Forbidden'.
Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Forbidden
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.FileContainer.Client.FileContainerHttpClient.UploadFileAsync(Int64 containerId, String itemPath, Stream fileStream, Byte[] contentId, Int64 fileLength, Boolean isGzipped, Guid scopeIdentifier, CancellationToken cancellationToken, Int32 chunkSize, Int32 chunkRetryTimes, Boolean uploadFirstChunk, Object userState)
   at Microsoft.VisualStudio.Services.FileContainer.Client.FileContainerHttpClient.UploadFileAsync(Int64 containerId, String itemPath, Stream fileStream, Guid scopeIdentifier, CancellationToken cancellationToken, Int32 chunkSize, Boolean uploadFirstChunk, Object userState, Boolean compressStream)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.FileContainerServer.UploadAsync(IAsyncCommandContext context, Int32 uploaderId, CancellationToken token)

Detail upload trace for file that fail to upload: ssmd-21.0.0.106-gae26b4b/SSMD-21.0.0.106.dll
Begin chunking upload file 'ssmd-21.0.0.106-gae26b4b/SSMD-21.0.0.106.dll', chunk size '4194304 Bytes', total chunks '2'.
Attempt '1' for uploading chunk '1' of file 'ssmd-21.0.0.106-gae26b4b/SSMD-21.0.0.106.dll'.
Generate new HttpRequest for uploading file 'ssmd-21.0.0.106-gae26b4b/SSMD-21.0.0.106.dll', chunk '1' of '2'.
Start uploading file 'ssmd-21.0.0.106-gae26b4b/SSMD-21.0.0.106.dll' to server, chunk '1'.
Chunk '1' attempt '1' of file 'ssmd-21.0.0.106-gae26b4b/SSMD-21.0.0.106.dll' fail to send request to server. Error: Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Forbidden
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.FileContainer.Client.FileContainerHttpClient.UploadFileAsync(Int64 containerId, String itemPath, Stream fileStream, Byte[] contentId, Int64 fileLength, Boolean isGzipped, Guid scopeIdentifier, CancellationToken cancellationToken, Int32 chunkSize, Int32 chunkRetryTimes, Boolean uploadFirstChunk, Object userState).
Backoff 8.74 seconds before attempt '2' chunk '1' of file 'ssmd-21.0.0.106-gae26b4b/SSMD-21.0.0.106.dll'.

[...]

最佳答案

Fail to upload windows dll due to 'Forbidden' (using PublishBuildArtifacts to Azure DevOps)

根据您的描述,exe文件上传成功,dll文件上传失败。

这意味着我们的任务或管道是正确的。然后结合错误日志:

Fail to upload 'C:\agent-azure-v2.174.1\_work\1\s\batchfiles\SSMD\SSMD-21.0.0.106.dll' due to 'Forbidden'.

因此我们可以推测您的私有(private)构建机器或公司网络应该有一个代理 block .dll 文件。你应该检查一下。

要验证这一点,您可以尝试使用托管代理来验证此问题。

关于azure - 由于 'Forbidden',无法上传 Windows dll(使用 PublishBuildArtifacts 到 Azure DevOps),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63896636/

相关文章:

javascript - 使用 Javascript 将大文件上传到 Azure Blob

ios - 如何从适用于 Azure Mobile Engagement 的 iOS 应用程序获取正确的设备 ID(显示在门户中)

azure-devops - 如何在 Azure DevOps 管道中添加单元测试

node.js - 如何将 Azure DevOps 构建管道连接到专用终结点

azure - 如何在 Azure Web 应用服务上获取 IP 地址

facebook - 视频和照片的图形 API 上传大小限制

java - 我想知道添加到 blob 存储的文件的位置

Azure 容器经常连接到 23.97.221.176 :11041. 这个端口的用途是什么?

javascript - 为什么上传文件 Controller 没有隐藏?

java - 将图片上传为 Base64 字符串并截击返回警告 : LogSlowRequest