---
title: Debugging the .NET agent in Windows
source: https://docs.newrelic.com/docs/apm/agents/net-agent/troubleshooting/debugging-net-windows
---

## Problem

After [installing New Relic's .NET agent for Windows](https://docs.newrelic.com/docs/apm/agents/net-agent/installation/install-net-agent-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:

-   Make sure you have administrator privileges on your host.
-   Ensure that the [installation and execution steps have been followed](https://docs.newrelic.com/docs/apm/agents/net-agent/installation/install-net-agent-windows)

## Step 1: Check for agent logs of the application [#step-one]

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 [#step-two]

To check if the profiler is loaded:

1.  Download and extract [Microsoft Process Explorer](https://learn.microsoft.com/en-us/sysinternals/downloads/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.

        > #### ⚠️ IMPORTANT
        >
        > -   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](https://docs.newrelic.com/docs/agents/net-agent/getting-started/compatibility-requirements-net-framework-agent)

> #### ⚠️ IMPORTANT
>
> The use of [Code Access Security](https://docs.microsoft.com/en-us/dotnet/framework/misc/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](#step-four) (permissions).

## Step 3: Check for required environment variables [#step-three]

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.

**.NET Framework: check for environment variables**

Assuming you installed the agent using the .msi installer, the environment variables that appear in the environment tab should be similar to these:

````ini
COR_ENABLE_PROFILING = 1
COR_PROFILER = {71DA0A04-7777-4EC6-9643-7D28B46A8A41}
NEWRELIC_INSTALL_PATH = C:\Program Files\New Relic\.NET Agent
```

For more details on these variables, as well as correct values for other installation scenarios, please see [understanding .NET agent environment variables](/docs/apm/agents/net-agent/other-installation/understanding-net-agent-environment-variables/).

If the environment variables don't match what you see above you can re-run the .NET agent installer (.msi) and select `Repair` when prompted to restore them to the default.

If the environment variables above are not present in the process at all, it usually means one of the following things:

* <DNT>**IIS applications**</DNT>: There are <DNT>**[permissions issues](/docs/agents/net-agent/troubleshooting/no-data-registry-key-permission-issues)**</DNT> on your server which are preventing the application you're trying to monitor from accessing the registry keys where the variables are set.
* <DNT>**Non-IIS applications**</DNT>: The [“Instrument all .NET applications” feature](/docs/agents/net-agent/additional-installation/instrument-non-iis-apps) was not selected when the agent was installed. Out-of-the-box, the Framework agent monitors IIS-hosted web apps. If the `Instrument all .NET Applications` feature is not installed, the agent will ignore all non-IIS applications that start up on your server. You can check whether the feature was installed by looking at the Windows system environment variables for the server and seeing if the above variables are set. If they're not, re-run the installer and select the `Instrument all .NET applications` feature when prompted.

<Callout variant="important">
  If the application you want to monitor is not hosted in IIS (such as a self-hosted Windows service), you must enable `Instrument All` and also explicitly enable the agent for that application, as noted in our [installation docs](/docs/apm/agents/net-agent/installation/install-net-agent-windows#enabling-the-agent).
</Callout>

If you made any changes to the environment variables, make sure to issue a command-line `iisreset` or restart your application process (if it's non-IIS). Then inspect the new process PID in Process Explorer in order to ensure the changes were successful.

<Callout variant="important">
  If the application name is showing up in New Relic, but no transactions are appearing, it's likely because no traffic is hitting the app, or else the agent is not encountering a [known framework](/docs/apm/agents/net-agent/getting-started/net-agent-compatibility-requirements/#app-frameworks-framework) that it can automatically instrument.

  If your application does not use one of those compatible app frameworks, you may need to [custom instrument your application](/docs/apm/agents/net-agent/custom-instrumentation/introduction-net-custom-instrumentation/), in order to tell the agent what parts of your application are important for monitoring and what constitutes the scope of a transaction.
</Callout>

````

**.NET Core: check for environment variables**

Assuming you installed the agent using the .msi installer, the environment variables that appear in the environment tab should be similar to these:

````ini
CORECLR_ENABLE_PROFILING=1
CORECLR_PROFILER={36032161-FFC0-4B61-B559-F6C5D41BAE5A}
NEWRELIC_INSTALL_PATH=C:\Program Files\New Relic\.NET Agent\
CORECLR_NEWRELIC_HOME=C:\ProgramData\New Relic\.NET Agent\
```

These variables are set manually as part of the installation process or at run time. If changes need to be made, adjust the variables in Windows or wherever you have set the variables for this application.

For more details on these variables, as well as correct values for other installation scenarios, please see [understanding .NET agent environment variables](/docs/apm/agents/net-agent/other-installation/understanding-net-agent-environment-variables/).

If you don't see the variables above in Process Explorer when inspecting your application's process, make sure you have the variables set and that they are accessible to the application at run time.

<Callout variant="important">
  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](/docs/apm/agents/net-agent/getting-started/net-agent-compatibility-requirements/#app-frameworks-core) that it can automatically instrument.

  If your application does not use one of those compatible app frameworks, you may need to implement [custom instrumentation](/docs/apm/agents/net-agent/custom-instrumentation/introduction-net-custom-instrumentation/) to tell the agent what parts of your application are important for monitoring and what constitutes the scope of a transaction.
</Callout>

If the application you want to monitor is not hosted in IIS (such as a self-hosted Windows service), you must configure your application to be monitored by setting the following environment variable:

```ini
CORECLR_ENABLE_PROFILING=1
```

We recommend setting the environment variables for each application you want monitored. If you set them globally, you might instrument other .NET processes in addition to the application you want to monitor.

<Callout variant="tip">
  For tips on setting this environment variable per process instead of system-wide, see [our forum post on setting environment variables](https://knowledge.newrelic.com/s/article/Setting-dot-NET-Core-agent-environment-variables-per-process).
</Callout>

````

## Step 4: Check permissions [#step-four]

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](#step-one).

If the above steps did not address the issue, we recommend you contact support or ask for help on [our Support Forum forum](https://support.newrelic.com/s/hubtopic/Topic__c/Default?c__categories=%5B%7B%22icon%22%3A%22standard%3Adefault%22%2C%22id%22%3A%22a6c8W000000EesgQAC%22%2C%22sObjectType%22%3A%22Category__c%22%2C%22title%22%3A%22.Net%20Agent%22%2C%22titleFormatted%22%3A%22.Net%20Agent%22%7D%5D).
