Name your .NET application

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

When you first deploy your app, change the default name to a descriptive name. You can also aggregate metrics by using multiple names.

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 via the .NET agent API will not be persisted between application restarts.

Name IIS-hosted apps

You can name an IIS-hosted application via either web.config or newrelic.config. Naming via web.config ensures each of your applications has a descriptive name, ensuring that your metric data does not get aggregated improperly across multiple apps. If you do not want to alter web.config, you can name via the app's local newrelic.config.

Name app via web.config

Naming your app via web.config ensures each of your unique applications has a descriptive name. The web.config setting overrides the settings in newrelic.config.

  1. Add the following entry to your web.config file:

    <appSettings>
        <add key = "NewRelic.AppName" value="Primary Name" />
    </appSettings>

    To give your app multiple names (up to three), separate them with commas. The first name assigned to your application is the primary name.

    <appSettings>
        <add key="NewRelic.AppName" value="My First Application, My Second Application, My Third Application"/>
    </appSettings>
  2. Reset IIS.

As long as your app is receiving traffic, data should appear within a few minutes. If not, see No data appears.

Name via newrelic.config

If you do not want to edit web.config, you can copy newrelic.config into your app's root folder and edit the name there. Copying newrelic.config will override the global file.

  1. Copy newrelic.config from the agent home directory into your app's root folder. The location of the agent home folder varies:

    • Default: %ALLUSERSPROFILE%\New Relic\.NET Agent
    • Windows 2003: %ALLUSERSPROFILE%\Application Data\New Relic\.NET Agent
  2. Open the copy of newrelic.config. Specify a new name for your application in the <name> element:

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

    To give your app multiple names (up to three), specify each name individually with <name>. The first name assigned to your application is the primary name.

    <application>
        <name>My Application</name>
        <name>Second App Name</name>
        <name>Third App Name</name>
    </application>
  3. Reset IIS.

As long as your app is receiving traffic, data should appear within a few minutes. If not, see No data appears.

Name after app pools

To name your app according to its parent app pool, remove all explicit naming from newrelic.config and web.config. Ensure each app has a descriptive name by following the procedures in the SNCI naming instructions.

In the newrelic.config, leave the <application></application> parent element and only remove the child <name> </name>

<application>
   <name> "Descriptive Name" </name>
</application>

Name non-IIS apps

To name your non-IIS hosted application:

  1. Add the following entry to your app config file (for example, applicationname.exe.config):

    <appSettings>
        <add key = "NewRelic.AppName" value="Descriptive Name" />
    </appSettings>

    To give your app multiple names (up to three), separate them with commas:

    <appSettings>
        <add key="NewRelic.AppName" value="My First Application, My Second Application, My Third Application"/>
    </appSettings>
  2. Restart your application.

As long as your app is active, data should appear within a few minutes. If not, see No data appears.

Name via external file

If you normally specify configuration options for your app in an external file, you can call that external file to set your app's name:

  1. Verify that web.config or app.config is calling an external file.
  2. Add the follow entry to your appSettings file:

    <appSettings>
        <add key = "NewRelic.AppName" value="Descriptive Name" />
    </appSettings>

    To give your app multiple names (up to three), separate them with commas. The first name assigned to your application is the primary name.

    <appSettings>
        <add key="NewRelic.AppName" value="My First Application, My Second Application, My Third Application"/>
    </appSettings>
  3. Reset IIS.

As long as your app is receiving traffic, data should appear within a few minutes. If not, see No data appears.

Shared Network Content Infrastructure

If you are using Shared Network Content Infrastructure, each of your apps will report to a single name by default. This is because SNCI uses only one web.config file. To ensure each unique application has a descriptive name:

  1. Split each application into its own app pool, and assign each app pool a descriptive name.
  2. Remove all naming from web.config (if any) by removing all NewRelic.AppName keys from appSettings:

    <appSettings>
    </appSettings>
  3. Remove all naming from newrelic.config (if any) by removing all <name> elements from the <application> element. Ensure you do not delete the surrounding <application></application> tags.

    <application>
    </application>

Each app will then report according to its app pool name.

In SNCI environments, preloading app pools will restrict New Relic's ability to capture the application name. Be sure to disable preloading app pools if using SNCI.

For more help

Additional documentation resources include:

Join the discussion about .NET monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.