This document explains how to install and enable the APM .NET agent on a Windows system.
To use .NET or any other agent, and the rest of our observability platform, join the New Relic family! Sign up to create your free account in only a few seconds. Then ingest up to 100GB of data for free each month. Forever.
The install instructions in this document are for a standard .NET agent installation on Windows. However, some setups have specific caveats and instructions, which you should read first:
- ASP.NET Core
- Azure install
- NuGet install
- Docker container install
- Windows Communication Foundation (WCF)
- Apps not hosted in IIS
The latest version of the .NET agent supports .NET Framework 4.5 and higher. If you have legacy applications you wish to monitor, see support for earlier .NET Framework versions.
Our guided install creates a customized CLI command for your environment that downloads and installs the .NET agent for Windows IIS applications.
Ready to get started? Click the Guided install button. If your account reports data through our EU datacenter, click EU Guided install.
In addition to the .NET agent, you can use the CLI to install and use our infrastructure agent to discover other applications, infrastructure, and log sources running in your environment and recommend which ones should be instrumented. The install automates the configuration and deployment of each system you choose to instrument.
To install the .NET agent:
Ensure you have admin rights for your Windows admin group. For more on this, see permissions documentation.
Download the installer that matches your system architecture:
Run the install wizard. Tips for using the install wizard:
- When prompted, input your New Relic license key.
- Consider leaving Instrument all disabled if you will only be monitoring applications hosted with IIS. Otherwise, enable Instrument all and follow additional instructions to enable the agent for your application.
- If you are changing an existing installation using the install wizard, select the Change option.
- Optional: you can also run the installer via the command line or from a script. This can be useful for automating your agent install.
For each application you wish to monitor, give your application a meaningful name. Make sure to review the steps on Name your .NET application for information on setting your app name.
If your application is short-lived (existing for less than 60 seconds), it will require configuration or it won't report data.
Restart affected applications. If using IIS, restart IIS.
If your application is receiving traffic, data should appear within a few minutes. If it doesn't, see No data appears.
This section describes a command-line alternative to the standard install procedure.
Instead of using the MSI install wizard, you can run the MSI from the command line or from a script. This can be useful for automating your agent install.
Here is the command to perform a new agent install using the MSI installer. (For changes to an existing installation, use the
ADDLOCAL command.) Replace the highlighted sections with relevant values.
msiexec.exe /i C:\PATH_TO\newrelic-agent-win-x86-VERSION.msi /qb NR_LICENSE_KEY=YOUR_LICENSE_KEY INSTALLLEVEL=1
INSTALLLEVEL can be either
1: Installs .NET agent with default options (described in table below). If your application is not hosted on IIS or uses IIS as a reverse proxy, you should use option
50: Installs the agent with InstrumentAllNETFramework enabled (described below).
Instead of using the
INSTALLLEVEL presets, you can customize which features to install with the
ADDLOCAL command shown below. This is also the command you'd use to update an existing installation.
msiexec.exe /i C:\PATH_TO\newrelic-agent-win-x86-VERSION.msi /qb NR_LICENSE_KEY=YOUR_LICENSE_KEY ADDLOCAL=OPTION_1, OPTION_2
Available options are:
Enabled by default. This identifies the registry keys used to attach the .NET profiler to a .NET Framework application. Without this, our .NET agent won't work for an IIS-hosted .NET Framework app.
Enabled by default. This identifies the registry keys used to attach the .NET profiler to a .NET Core application. Without this, the .NET agent will not work for an IIS-hosted .NET Core app.
This will result in all .NET Framework applications being instrumented by setting global environment variables. This setting is the equivalent of selecting Instrument all in the MSI install wizard.
Enabled by default. Adds several useful shortcuts to your start menu.
Enabled by default. Adds the ASP.NET cache flush tool which, when run, clears out some .NET temporary files and restarts IIS.
If the application you want to monitor is not hosted in IIS, you will follow the standard install procedure but in addition you must explicitly enable the agent for that application. Enabling the agent differs for .NET Framework and .NET Core applications.
When following the standard install procedure, we recommend that you enable Instrument all.
Enable the agent for your application with one of the following methods:
For .NET Core, you must configure your application to be monitored by setting the following environment variable:
We recommend setting the environment variables for each application you want to instrument. If you set them globally, you might instrument .NET processes other than your apps.
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.