本文介绍了如何为HttpClient调用配置网络跟踪Dotnet核心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据参考文档,网址为

As per reference document at https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-configure-network-tracing

我们可以在web.config或任何其他配置文件中进行设置,我们获得详细的system.net跟踪, HttpClient 调用的数据包跟踪以及<$中的任何问题c $ c> HttpClient 调用可以在跟踪中捕获,无论是证书,TLS还是其他任何东西。

We can setup this in web.config or any other configuration file and we get detailed system.net traces, packets traces for HttpClient calls and any kind of issue in HttpClient calls can be captured in traces, be it certificate, TLS or anything else.

但是,我们有类似的实现吗?是否可以在Web应用程序或控制台应用程序/库中使用的dotnet核心/标准?

However, do we have similar implementation for dotnet core / standard which can be used in both web app or console app/ libraries ?

dotnet框架的配置:

Configuration for dotnet framwork :

<configuration>  
  <system.diagnostics>  
    <sources>  
      <source name="System.Net" tracemode="includehex" maxdatasize="1024">  
        <listeners>  
          <add name="System.Net"/>  
        </listeners>  
      </source>  
      --------------
----------------------


推荐答案

.NET Core使用记录这些事件。在Windows上,事件源使用,因此可以使用与之配合使用的所有工具来记录和读取跟踪输出。在Linux上,用于记录事件。

.NET Core uses EventSource to record these events. On Windows the event source uses Event Tracing for Windows (ETW) so all tools that work with it can be used to record and read through the trace output. On Linux, LTTNG is used to record the events.

Microsoft的CoreFX存储库,该文档介绍了如何同时使用和。他们的CoreCLR存储库包含也很有用。

Microsoft's CoreFX repository contains documentation for Windows on how to debug network traces using both PerfView and logman. Their CoreCLR repository contains documentation on capturing traces on Linux that is also useful.

Microsoft正在努力以某种方式统一跨平台的体验。目前,这种支持似乎通过。

Microsoft is working on unifying the experience across platforms in a way. At the moment this support seems to be happening through the dotnet-trace command.

您没有直接提及ASP.NET Core,因此我假设您的问题并非特定于此,但请注意正如Alexandre指出的那样,可以配置,并且可能会提供您所需的一些或全部。

You didn't mention ASP.NET Core directly, so I will presume your question isn't specific to it, but note that as Alexandre pointed out, tracing can be configured and may provide some or all of what you need.

这篇关于如何为HttpClient调用配置网络跟踪Dotnet核心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 16:46