Azure devops 管道,在发布期间检查 ftp 流量

Azure devops pipelines, inspect ftp traffic during release

有没有办法记录来自 Microsoft 托管代理的详细 [​​=18=] 流量? 就我而言,当 运行ning ui 在发布管道中进行测试时,屏幕截图会上传到 ftp 服务器。 昨天当我开始出现以下错误时,它在几周内都运行良好:

ftp 服务器端和用于上传 ftp 文件的 c# 代码没有变化。 当我 运行 在本地测试时,上传文件仍然可以正常工作,并且只有当它们 运行 来自管道时才会发生此问题,所以我考虑比较网络流量,寻找一些线索。

Is there a way to log detailed ftp traffic from microsoft hosted agent?

您可以尝试使用 network tracing 来收集 Ftp 流量日志。

您可以在配置文件中添加配置(例如 web.config , app.config)。

例如:要收集 FTPWebRequestFtpWebResponse 信息,您可以使用 system.net.

<configuration>
  <system.diagnostics>
    <sources>
      <source name="System.Net" tracemode="protocolonly" maxdatasize="1024">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="System.Net" value="Information"/>
    </switches>
    <sharedListeners>
      <add name="System.Net"
        type="System.Diagnostics.TextWriterTraceListener"
        initializeData="network.log"
      />
    </sharedListeners>
    <trace autoflush="true"/>
  </system.diagnostics>
</configuration>

然后它将创建一个 network.log 文件。

由于您使用的是 Microsoft 托管代理,您可以确定文件位置并使用 Publish Build Artifacts task 将文件作为构建工件上传。