Native hosted WCF services


I have several native WCF services hosted as windows services and some hosted on IIS. for IIS services, I have created a new newrelic.config file and seems to be working fine. However, for the native WCF services separate newrelic.config file is not accounted but if I add the below 2 in app.config of the service, new relic monitors successfully.

Has any one successfully be able to use separate newrelic.config file for native WCFservices?

Hi @swarup.jinugu - The documentation contains options on configuring WCF services.

This is the important part for your question:

While many WCF applications are hosted in IIS, WCF applications can also be hosted as a custom Windows Service, a console app, or a Windows Forms app. To instrument self-hosted WCF applications, see Instrumenting non-IIS apps.

1 Like

Firstly: Thank you so much for your response.

What I understood from the documentation is that the instrumentation is generic for all services/apps running on server X. For example, if a server X has N number of non IIS apps running, then the newrelic.config of that server X instrumentation section may be updated to start monitoring. However, the name should be specified in applications app.config file.

And I am trying to create separate config files for each of the native WCF services instead of relaying on one newrelic.config file. Either case, it sounds like, I would still have to update app.config to name the application.


What I intended to do is create separate newrelic.config files for each native hosted WCF services and place them in the application’s root directory with out changing app.config file (except for naming)

Hello @swarup.jinugu

If you don’t want to name the application using the app.config file, you should be able to use a combination of both the global and local newrelic.config files to configure the agent to monitor your applications.

First, in order to tell the profiler to pay attention to your application, edit the global newrelic.config file at C:\ProgramData\New Relic\.NET Agent to include the following, as a child of the <configuration> element (replacing “MyService.exe” as needed):

        <application name="MyService1.exe" />

Next, make a copy of the newrelic.config file located at C:\ProgramData\New Relic\.NET Agent and place it in the root folder of the application you want to monitor. This makes the config file application-specific.

Inside the application-specific config file, change the name of your application in the line that looks like this:

<name>My Application</name>

Note that this name will be ignored if the application is also named inside the app.config file. If you don’t want to name the application in the app.config file, remove the app.config file line that looks like this <add key = "NewRelic.AppName" value="Unique Name" />

Once this is all done, restart your application’s host process in order to allow the agent to pick up the changes. Exercise the application in order to get some data collected and the application should show up in your account a few minutes later.

One last thing to note. This process tells the agent to pay attention to your application and what to name it in the UI. It does not, however, tell the agent which parts of your application to monitor. Database and external calls will likely be collected in the APM UI, but without custom instrumentation, you will not see any transactions reported for non-IIS applications.

A good place to get an overview of creating custom instrumentation for non-IIS applications is in this forum post.

Let us know if you have any questions. I hope this helped.


Thank you Don. I will try this out.

@swarup.jinugu - Glad we found something for you to try. Please be sure to come back and let us know if it worked. That way everyone cal learn!

@hross @dmorris Thank you so much for your inputs on this. With instrumentation it is working as I expected. Steps I did:

  1. Added instrumentation to the global newrelic.config file
  2. Copied global newrelic.config file to application’s root directory
  3. When copied, it get’s Instrumentation child element as well. Removed it.
  4. Changed the element to some thing like “XXXX”
  5. Removed all New relic configuration from application’s app Config.
  6. Restarted the EXE
  7. Sent some traffic accessing the application
  8. Noticed the traffic in New relic.

However, we chose to go ahead with application’s app.config for EXE’s as it appeared easy to maintain as opposed to changing the global newrelic.config file.