.NET Core agent not monitoring program

Running .NET Core x64 8.15.455 installed per instructions via .zip file on Windows Server 2012 R2

.NET Core 2.1

I have built a simple console program that counts once per second and outputs the count. When I run the program, it never shows up.

Agent files were all extracted to C:\NewRelic

The app name is Counter (app file is Counter.exe)

I’m pretty clearly missing something, but I can’t see what it is.

I have tried setting the name in Counter.exe.config:
<?xml version="1.0" encoding="utf-8" ?>




I have tried setting it up using newrelic.config:
<?xml version="1.0"?>





Counter






System.IO.FileNotFoundException
System.Threading.ThreadAbortException


401
404




System.Threading.WaitHandle:InternalWaitOne
System.Threading.WaitHandle:WaitAny

And I have tried using the environment variables:
CORECLR_ENABLE_PROFILING=1
CORECLR_PROFILER={36032161-FFC0-4B61-B559-F6C5D41BAE5A}
CORECLR_NEWRELIC_HOME=C:\NewRelic
CORECLR_PROFILER_PATH=%CORECLR_NEWRELIC_HOME%\NewRelic.Profiler.dll
NEW_RELIC_LICENSE_KEY=<license_key>
NEW_RELIC_APP_NAME=Counter

None of these seem to work. When I run the program, I never see it show up. What am I missing?

Not sure what happened with the XML, trying again:

Counter.exe.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="NewRelic.AppName" value="Counter" />
  </appSettings>
</configuration>

newrelic.config:

<?xml version="1.0"?>
<!-- Copyright (c) 2008-2019 New Relic, Inc.  All rights reserved. -->
<!-- For more information see: https://newrelic.com/docs/dotnet/dotnet-agent-configuration -->
<configuration xmlns="urn:newrelic-config" agentEnabled="true">
	<service licenseKey="[redacted]" />
	<application>
		<name>Counter</name>
	</application>
	<log level="info"/>
	<transactionTracer enabled="true"
		transactionThreshold="apdex_f"
		stackTraceThreshold="500"
		recordSql="obfuscated"
		explainEnabled="false"
		explainThreshold="500"/>
	<crossApplicationTracer enabled="true"/>
	<errorCollector enabled="true">
		<ignoreErrors>
			<exception>System.IO.FileNotFoundException</exception>
			<exception>System.Threading.ThreadAbortException</exception>
		</ignoreErrors>
		<ignoreStatusCodes>
			<code>401</code>
			<code>404</code>
		</ignoreStatusCodes>
	</errorCollector>
	<browserMonitoring autoInstrument="true" />
	<threadProfiling>
		<ignoreMethod>System.Threading.WaitHandle:InternalWaitOne</ignoreMethod>
		<ignoreMethod>System.Threading.WaitHandle:WaitAny</ignoreMethod>
	</threadProfiling>
</configuration>

Hi, @claudia.peredo: You may find this post helpful:

1 Like

Hi @claudia.peredo

Have you created any custom instrumentation for your sample application yet? The .NET Core agent contains default instrumentation for ASP .NET Core web applications, but for console applications you have to tell the agent what parts of the application you want to monitor.

1 Like

I do not have custom instrumentation, was not aware that would be required. So without that, the app won’t appear at all, won’t even report its existence?

Hi @claudia.peredo

you will need to use custom Instrumentation to get transactions appearing, this is due to your application configuration

I’m currently working on setting that up. What I’m confused about is this: custom instrumentation is required to even SEE the app in NR at all?

Can you please point me to where this is explained in the documentation? I must have missed something. I would like to see what it was and try to understand better.

Hi, @claudia.peredo: The application name should appear in New Relic, even without custom instrumentation. The link I posted in my first reply will help you troubleshoot why that is not happening.

So I cleared everything off and started fresh, with a new installation of the agent and a new application, this one is a UI application.

I followed the troubleshooting guide. Upon installing the agent, I selected “Instrument All”. I get no logs. When I follow the next steps using Process Explorer, I don’t see the environment variables set.

Per the guide, I updated the installation. I see the environment variables in the server properties, but when I restart my application, I still don’t see them.

For reference, I’m using this: Relic Solution: .NET Framework Agent Installation Issues - A Troubleshooting Guide
I am stuck on step 3

OK, I tried it myself: I downloaded the .NET Core x64 agent as a Zip file and extracted to C:\NewRelic. I set the environment variables specified in the documentation:

I then created a console application that increments a counter once per second (called Counter), and ran it. The New Relic log files appeared in C:\NewRelic\Logs:

And the application name appeared in New Relic APM:

If I specified the app name and license key as environment vars, I did not have to modify any .config files. I also tried adding my license key and app name to C:\NewRelic\newrelic.config and deleting the corresponding environment vars; that also worked.

If you are not seeing log files, I suspect that your user account does not have write permission to C:\NewRelic. Can you try running your application as Administator?

2 Likes

I am at a complete loss. I have the environment variables set as described. I am running both the counter console app and the UI app as Administrator. I have checked the file and folder permissions.

I have tried both the .NET Core and the .NET Framework agents, together and separately. At this point, I don’t know what else to do.

I’ve created a ticket for this issue so we can get your application reporting. We’ll share what the solution turns out to be here.

Claudia,
I am having the exact same problem. I created all the instrument XML files, nadda.
No log files , nothing
John

Hi Claudia

Im going to draw your attention to this… it is in my colleague @dmorris’s super helpfull post

In the application’s config file : Add the following line inside the <appSettings> element of your app’s config file.

<add key="NewRelic.AgentEnabled" value="true" />

In the global newrelic.config file : Add the following to your global newrelic.config file ( C:\ProgramData\New Relic\.NET Agent ), inside the <configuration> element. Make sure to adjust the file name as needed. Only the actual file name is needed, not the path to it.

<instrumentation>
    <applications>
      <application name="YourApplicationExecutable.exe" />
    </applications>
</instrumentation>

Please let me know if it was helpfull

1 Like

I think I tried that, but I will try again.

I already had NewRelic.AgentEnabled in the app config. I thought that if you used environment variables, you didn’t have to do anything with the newrelic.config?

Regardless, I added what you suggested, and I am still getting nothing. I now recall doing this when it was first suggested, with the same result.

Hi @claudia.peredo sounds like you’ve tried out quite a few things and that’s got to be frustrating.

Though, you say that no logs are generated, at all? No profiler, and no agent logs, at all? I’m curious if this document:

https://docs.newrelic.com/docs/agents/net-agent/troubleshooting/cocreateinstance-errors-no-profiler-log

Is relevant, in your case. There could very well be permissions issues, keeping logs from being written, or perhaps there is a profiler conflict.

Let us know if that helps move things forward!

Thanks for that link. So I’m not getting errors like what are shown there, but I AM getting this log entry:

.NET Runtime version 4.0.30319.0 - The profiler has requested that the CLR 
instance not load the profiler into this process.  Profiler CLSID: 
'{71DA0A04-7777-4EC6-9643-7D28B46A8A41}'.  Process ID (decimal): 3604.  
Message ID: [0x2516].

Based on that, it looks like the profiler is just refusing to load the agent?

I’m trying the other things on that page to see if any of them help.

After following the steps in the next section, I find that there are no New Relic assemblies. According to the instructions, my next step is to get support from New Relic.

HI, @claudia.peredo: There is already a support ticket open for you (#350048); you should have received an email from us on April 30.

That said, the document @netheroth linked to and the error message you posted seem to refer to the .NET Framework. I thought you were trying to install the .NET Core agent?

1 Like