• /
  • EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

Debugging the .NET agent in Azure Web Apps

Problem

After installing New Relic's .NET agent for Azure, you have one or more of the following problems:

  • You don't see any data.
  • You notice the application name appear in New Relic, but there's missing data.

Solution

Important things to verify and understand:

  • Ensure that the installation and execution steps have been followed, including restarting your web app.
  • You must disable Application Insights in order for the .NET agent to work properly.
  • The app must be getting traffic for the .NET agent to startup.
  • Beginning with .NET agent version 8.22.181.0, Azure's Always On setting may be enabled without interfering with the agent. If your application targets .NET Framework 4.0 or lower, Always On will interfere with the agent and the workarounds here are still applicable.

Step 1: Check for agent logs of the application

중요

You can use Kudu to check for agent logs, which is a site that runs in parallel with your website and provides various tools that can be used to examine processes, look at the file system, and download files and directories.

If your website's URL is example.azurewebsites.net, then the Kudu site is example.scm.azurewebsites.net. Use your site's deployment credentials to log into the Kudu site.

Important tips when checking for logs:

  • When using the New Relic Azure Site Extension, assuming that your Azure Web App uses a D: file system root, the log location defaults to D:\home\LogFiles\NewRelic. If your Azure Web uses a C: root, you'll need to use the correct drive letter.
  • If you installed the agent with the NewRelic.Agent or NewRelic.Azure.WebSites NuGet package, you'll find the logs folder in the directory where the agent was extracted within your project. This is often the newrelic folder within the wwwroot folder.

To check for agent logs:

  1. Make sure you're looking at current data. Delete or move any existing files in the logs directory so that you're sure the logs you generate reflect the current state of your system.
  2. Restart your application.
  3. Exercise your application for at least a few minutes in a way that would generate traffic you'd expect to see in your New Relic account.
  4. Make note of the process ID (PID) your application is running under, so you can verify if a log is being created for that process. You can find the PID by using Kudu's built-in Process Explorer.
  5. Go back to the agent logs directory, and look for a log file with a name containing the process ID of your application, for example, NewRelic.Profiler.[PID].log.
  6. If you see that profiler log file in the logs directory, then also check to see if there is a corresponding agent log. The agent log contains the prefix newrelic_agent. If you're running multiple .NET applications on your host, there may be more than one of these. If you see one or more you must determine which corresponds to the application you're trying to monitor.
  7. Search in the agent log for the string (pid [your PID]), for example (pid 1573). If you find that string in the log file, then you know it's the agent log associated with your application.
  8. Look for network or other errors that could cause the agent to fail to send data to New Relic.

Step 2: Check if the .NET agent profiler is loaded into the application's process

To check if the profiler is loaded:

  1. Use Kudu's built-in Process Explorer for Windows installs. For Linux installs, reference the commands in this article.
  2. In Process Explorer, find the process you're trying to monitor, and make note of the number in the PID column. If you're trying to monitor a web application, the process name will likely be w3wp.exe without the SCM label, which refers to the Kudu process itself. The agent shouldn't instrument the SCM (Kudu) process.
  3. When you've located your application's process, click on the Properties button.
  4. Click the Modules tab, and look for NewRelic.Profiler.dll — this DLL is required for the agent to monitor your application. If you can't find it, make sure the correct environment variables are present (more on this in step 3), and Microsoft Application Insights is disabled.

If you don't see NewRelic.Profiler.dll, continue to the next step. If you do see this DLL, and the app is receiving traffic, you should be seeing logs as described in step 1.

Step 3: Check for required environment variables

To check for the required environment variables:

  1. In Process Explorer, locate your application's process, and click on the Properties button.
  2. Select the Environment tab.

If the correct variables are set and the application you're trying to monitor has access to them, you should see a particular set of environment variables, depending on whether the agents you have installed are .NET Framework or .NET Core.

중요

These examples all assume that your Azure Web App uses a D: file system root. If your Azure Web uses a C: root, you need to use the correct drive letter when configuring these paths.

For further reading on these environment variables and their functionality, see how to understand .NET agent env variables.

If the application name is showing up in New Relic, but no transactions are appearing, it's likely because either no traffic is hitting the app, or the agent is not encountering a known framework that it can automatically instrument:

  • For automatically instrumented frameworks for .NET Core and .NET Framework, refer to our compatibility page.
  • If your application does not use one of those compatible app frameworks, you may need to implement custom instrumentation to tell the agent what parts of your application are important for monitoring and what constitutes the scope of a transaction.

If the above steps didn't help you fix your issues, we recommend you to contact support or ask for help on our Support Forum.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.