TracesMetricsApp LogsCustom LogsProfiling
✖️

This guide walks you through setting up Application Performance Monitoring (APM) on a .NET application. These instructions can also be found on the Installation page in your Middleware Account. View demo code here.

Prerequisites

  • Middleware Host Agent (MW Agent), to install the MW Agent please see our installation guide.
  • .NET 7+, you can check your .NET version with the following command.
Shell
dotnet --version

Step 1: .NET Binary Installation

Download the bash script.

Shell
curl -sSfL https://install.middleware.io/apm/dotnet/v1.0.0-rc.1/scripts/mw-dotnet-auto-install.sh -O

Install core files.

Shell
sh ./mw-dotnet-auto-install.sh
rm -rf mw-dotnet-auto-install.sh

Enable execution for the instrumentation script.

Shell
chmod +x $HOME/.mw-dotnet-auto/instrument.sh

Step 2: Setup Middleware .NET Project


  • Download Latest Middleware.dll and add the following code in the .csproj file..
XML
<ItemGroup>
  <Reference Include="Middleware">
    <HintPath>path\to\Middleware.dll</HintPath>
  </Reference>
</ItemGroup>

Step 3: Build and Run .NET Application

Shell
MW_API_KEY={MW_API_KEY} \
  . $HOME/.mw-dotnet-auto/instrument.sh && \
  OTEL_SERVICE_NAME="{APM-SERVICE-NAME}" \
  OTEL_RESOURCE_ATTRIBUTES=project.name="{APM-PROJECT-NAME}" \
  dotnet path/to/YourApplication.dll
Need assistance or want to learn more about Middleware? Contact us at support[at]middleware.io.