Name your .NET application

New Relic collects information by license key and then by the primary application identifier or app name. New Relic aggregates metrics using these names, which allows you to run the same application on multiple hosts and have combined metrics from all instances. This document explains the various methods to name .NET applications.

Use the .NET agent API

You can use the SetApplicationName() agent API call to set the application name at run time. This name will take priority over all other application name sources.

Each call to SetApplicationName will override the previous call. Application names set by using the .NET agent API will not be persisted between application restarts.

Use an environment variable

If you are using .NET agent version 6.17.387.0 or higher, you can use the environment variable NEW_RELIC_APP_NAME to set the application name. This name will take priority over an app's local newrelic.config. However, this name will not take priority over the web.config (the app config file for web applications not on IIS) or the SetApplicationName API call.

Name IIS-hosted apps

You can name an IIS-hosted application by using either of these options:

web.config: Naming with web.config ensures each of your applications has a descriptive name. This also ensures that your metric data does not get aggregated improperly across multiple apps.

newrelic.config: If you do not want to alter web.config, you can also name your app by using its local newrelic.config.

Name app using web.config

Naming your app using web.config ensures each of your unique applications has a descriptive name. This name will take priority over all application name sources except the SetApplicationName() API call.

Name app using newrelic.config

If you do not want to edit web.config (or your app config file for non-IIS apps), you can copy newrelic.config into your app's root folder and edit the name there. Copying newrelic.config will override the global file.

Copy newrelic.config from the agent home directory into your app's root folder as applicable:

Default: %ALLUSERSPROFILE%\New Relic\.NET Agent

Windows 2003: %ALLUSERSPROFILE%\Application Data\New Relic\.NET Agent

Open the copy of newrelic.config. Specify a new name for your application in the <name> element:

<application>
<name> App Name </name>
</application>

Optional: To give your app multiple names (up to three), specify each name individually with <name>. Assign the first name as the primary name.