• /
  • EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

Debugging the .NET agent in Windows

Problem

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

  • You don't see any data
  • You notice missing data
  • You don't see any logs

Solution

Important things to verify and understand:

Step 1: Check for agent logs of the application

Important tips before checking for logs:

  • When using the MSI Windows installer, it defaults to %ALLUSERSPROFILE%\New Relic\.NET Agent\Logs.
  • If you installed the agent with the NewRelic.Agent NuGet package, you'll find a logs folder in the directory where the agent was extracted on your system.

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. If your application is hosted in IIS, run a command-line IISRESET in an admin command line prompt.
  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 Windows Task Manager or 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. Download and extract Microsoft Process Explorer to your server.

  2. Launch the appropriate version of Process Explorer for your environment (32 vs 64 bit) as an administrator (right-click Run as Administrator).

  3. In the main window of 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 an IIS-hosted web application, the process name will be w3wp.exe.

  4. In the Process Explorer menu bar, select View > Show lower pane and then View > Lower pane view > DLLs.

  5. Highlight your application process in the upper pane, then check the lower pane for the following DLL(s).

    • NewRelic.Profiler.dll - This DLL is required for the agent to monitor your application. If it is not present, please make sure that the user the application is running under has read permissions to the folder where the agent was installed.

      重要

      • In the .NET Framework agent this should be the same as the NEWRELIC_INSTALL_PATH environment variable.
      • In the .NET Core agent this should be the same as the CORECLR_NEWRELIC_HOME environment variable.
    • mscorlib.dll: .NET Framework agent only. The presence of this DLL is how the agent identifies your app as a .NET Framework application. If it's not present, the agent ignores the app completely. If your app does not contain this DLL, please double-check to make sure your app meets the agent compatibility requirements

重要

The use of Code Access Security is compatible with the .NET agent only when Full Trust is provided. The agent is not compatible with more restrictive trust levels.

If you don't see NewRelic.Profiler.dll, continue to the next step. If you do get results, skip down to Step 4 (permissions).

Step 3: Check for required environment variables

To check for the required environment variables: Right-click on the process in Process Explorer and select Properties. You'll see a set of tabs at the top of the window that pops up. 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.

Step 4: Check permissions

Check the following permissions tasks:

  • Make sure that the user your application process is running under has read/write/execute permissions to the directory where the .NET agent was extracted on your system (NEWRELIC_INSTALL_PATH or CORECLR_NEWRELIC_HOME), and all of its sub-directories.
  • If you made any changes, restart your app and go back to Step 1.

If the above steps did not address the issue, we recommend you contact support or ask for help on our Support Forum forum.

Copyright © 2024 New Relic株式会社。

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