Instrumenting non-IIS apps

By default, the New Relic .NET agent instruments IIS-hosted ASP.NET applications. In some cases, you can also instrument other (non-IIS) .NET applications, such as standalone Windows Communication Foundation (WCF) services, console apps, and other Windows services provided they meet New Relic's requirements.


The .NET agent depends on HttpContext objects being instantiated to properly instrument and report on web transactions. These objects are created and populated as part of the ASP.NET HTTP pipeline, but they may not be created in other environments. You may still get data for other types of transactions (for example, database query traces), but web transactions depend on a valid HttpContext for tracing.

New Relic's harvest cycle is 60 seconds. If the non-IIS app does not run for a minimum of 60 seconds, you will need to add the sendDataOnExit and sendDataOnExitThreshold service elements to your newrelic.config to ensure that New Relic collects and receives your metrics properly. Make sure to set your sendDataOnExitThreshold value to less time than the process takes.

Enable instrumentation

To enable instrumentation of custom applications:

  1. If you are running any IIS-hosted applications, stop IIS. Otherwise, you will probably need to restart your system to finish the installation.
  2. From the New Relic menu bar, select (your account name) > Account settings.
  3. Download the .NET 64-bit or .NET 32-bit installer, as appropriate for your Windows version.
  4. Run the installer to enable the Instrument All .NET Applications feature:
    New installation

    If you have not installed the .NET agent before:

    1. When prompted, enter your New Relic license key (your license key is accessible from the Account settings page).
    2. From the Custom Setup screen, enable the Instrument All .NET Applications option.
    3. Change the default application name to a meaningful name.
    4. Specify the app you want to instrument.
    5. If you are running any IIS-hosted applications, restart IIS.
    6. Restart your application.
    Existing installation

    If you have already installed the .NET agent:

    1. Select the Change option.
    2. From the Custom Setup screen, enable the Instrument All .NET Applications option.
    3. Specify the app you want to instrument and make sure you have set the default application name to a meaningful name.
    4. If you are running any IIS-hosted applications, restart IIS.
    5. Restart your application.

Applications > (apps list): If your custom (non-IIS) .NET applications do not appear in your New Relic APM's Applications list, make sure you have enabled the installer's Instrument All .NET Applications feature, and then define your app in your app.config file or your newrelic.config file.

Define target applications

After enabling instrumentation for your custom app, tell the agent which processes to instrument. You can define this in one of two places:

Enable in the app's config file

Enable the agent in the application's config file. In the config file, add a new appSetting with a key named NewRelic.AgentEnabled and a value of true. For example, if the application name is DataServices.exe, edit DataServices.exe.config.

<?xml version="1.0" encoding="utf-8"?>
    <add key="NewRelic.AgentEnabled" value="true" />
    <add key="NewRelic.AppName" value="DataServices" />
Enable in newrelic.config

Enable the agent in newrelic.config. Add an instrumentation element with a child application element to each application. In the instrumentation element, provide the base file name, with extension, you would like to instrument. (for example, <application name="DataServices.exe" />).

      <application name="BusinessLogicServices.exe" />
      <application name="DataServices.exe" />

This does not name your application. It only declares that the process should be monitored by the .NET Agent. The next step is to name your application.

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