---
title: "Setting Up RUM with .NET"
slug: "enabling-rum-in-the-net-profiler"
updated: 2023-02-13T17:57:01Z
published: 2023-02-13T17:57:01Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting Up RUM with .NET

This document details how to enable **RUM** for the APM Profiler in your **.NET** application running on **Linux** or **Windows**.

## Prerequisites

### 1. Install the Latest Version of the Agent and Profiler

          Required Agent Versions

          

- Windows Agent v4.32+
- Linux Agent v2.31+
- .NET Profiler 1.4.5+

          
          

If you are running the .NET Legacy profiler, please [update to the V2 profiler](https://docs.stackify.com/docs/new-vs-legacy-net-profiler).

- **Linux** (on .NET Core) - Follow the [Retrace Linux Install for .NET Core](https://docs.stackify.com/docs/dotnetcore-linux-profiler) Guide.
- **Windows** - Follow the [Retrace Windows Install](/docs/net-agent-installation-overview) Guide.

### 2. Enable RUM

Follow the [RUM Getting Started guide](https://docs.stackify.com/v1/docs/real-user-monitoring) to **Enable RUM on your account** .

### 3. Setup APM for your Application

Follow the [.NET Getting Started Guide](https://docs.stackify.com/docs/net-getting-started) to configure the profiler for your specific setup. The profiler will need to be properly configured for RUM to function.

### 4. Configure the RUM Key

In order to identify the data coming from your application pages (which are tied to your account), you need to make your RUM Key available to your application. This setting is passed to your application via an environment variable, `RETRACE_RUM_KEY`.

**Windows** Add the `RETRACE_RUM_KEY` to the machine Environment Variables. Its value is the RUM Key available in the Retrace RUM configuration screen.

**Linux** Set the `RETRACE_RUM_KEY` environment variable so that it is available to the application when it launches. This will vary based on how the application is launched (e.g. via systemd or command line).

### 5. Inject Script into Page

The .NET profiler supports two methods to inject the script into your HTML pages. If you are using ASP.Net MVC or WebForm, you can try to enable auto injection of the script into your application. If this method does not work or you are using an unsupported UI framework, you can inject the script via an API method that you add to your page templates.

**Automatic Injection** Automatic Injection is enabled by setting the environment variable `RETRACE_RUMV2_ENABLED` to the value of ‘true”.

**Manual Injection via API** The manual injection method requires that an API call to [StackifyLib](https://github.com/stackify/stackify-api-dotnet) is inserted into the HTML files without any quoting of the injected string. For example, in an ASP.Net application using Razor pages for the view, you would inject the output of the `StackifyLib.Web.RealUserMonitoring.GetHeaderScript` method into the page(s) that contain the element of the page. This is typically in the `_Layout.cshtml` for simple applications like this:

```
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	@Html.Raw(StackifyLib.Web.RealUserMonitoring.GetHeaderScript())
	<title>@ViewData["Title"]</title>
…
</head>
```

This API method is available in StackifyLib versions **2.2 and greater**.

### 6. Redeploy your App

Once the previous steps to enable RUM for your account and add the code snippet to your app(s) have been completed, the last step is to deploy the changes to your application.

## Viewing RUM Data

Once the following steps have been taken to set up RUM for your apps, data will be reported in the corresponding [App Dashboard](https://docs.stackify.com/v1/docs/account-application-dashboard-overview). To see more information related to what RUM data is presented in the App Dashboard, see the [Viewing RUM Data in Retrace](https://docs.stackify.com/v1/docs/viewing-rum-data-in-retrace) help doc.
