Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Configure Network Tracing Dotnet core for HttpClient calls?

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

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.

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

Configuration for dotnet framwork :

<configuration>  
  <system.diagnostics>  
    <sources>  
      <source name="System.Net" tracemode="includehex" maxdatasize="1024">  
        <listeners>  
          <add name="System.Net"/>  
        </listeners>  
      </source>  
      --------------
----------------------
like image 582
Paras Patidar Avatar asked Apr 02 '19 14:04

Paras Patidar


People also ask

What is tracing in .NET core?

ASP.NET tracing enables you to follow a page's execution path, display diagnostic information at run time, and debug your application. ASP.NET tracing can be integrated with system-level tracing to provide multiple levels of tracing output in distributed and multi-tier applications.

What is network tracing?

Network tracing is a process that traverses a hierarchical network (pits/pipes etc.) The hierarchical network is composed of connected edges (lines) and nodes (points). The trace compiles a set of edges that connect to the initial start edge and can be limited in extent by defining break points at nodes in the network.


1 Answers

.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's runtime repository contains documentation for Windows on how to debug network traces using both PerfView and logman. There's also documentation on capturing traces on Linux that is useful.

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.

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.

like image 52
Kaleb Pederson Avatar answered Nov 24 '22 06:11

Kaleb Pederson