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.

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.

Enabling 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.
    4. If you are running any IIS-hosted applications, restart IIS.
    5. Restart your application.
dotnet-no-apps-dashboard-download

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.

Defining 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 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"?>
    <configuration>
      <appSettings>
        <add key="NewRelic.AgentEnabled" value="true" />
      </appSettings>

     

  • Enable the agent in newrelic.config. Add an instrumentation element with a child application element to each application. In the instrumentation element, define one or more application names (for example, <application name="DataServices.exe" />). Set each application name to the name of your custom application. You can specify multiple names for an app.

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

     

For more help

Additional documentation resources include:

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