This product is not supported for your selected Datadog site. ().
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

You can enable App and API Protection for .NET services with the following setup options:

  1. If your .NET service already has APM tracing set up and running, then skip to service configuration.
  2. If your .NET service doesn't have APM tracing set up, you can easily enable App and API Protection with Datadog's Automatic Installation.
  3. Otherwise, continue reading the manual setup instructions below.

Overview

App and API Protection leverages the Datadog .NET library to monitor and secure your .NET service. The library integrates seamlessly with your existing application without requiring code changes.

For detailed compatibility information, including supported DOTNET versions, frameworks, and deployment environments, see .NET Compatibility Requirements.

This guide explains how to set up App and API Protection (AAP) for .NET applications. The setup involves:

  1. Installing the Datadog Agent.
  2. Enabling App and API Protection monitoring.
  3. Running your .NET application with the Datadog Agent.
  4. Verifying the setup.

Prerequisites

  • Windows operating system
  • .NET application
  • Administrator privileges for some configuration steps
  • Your Datadog API key
  • Datadog .NET tracing library (see version requirements here)

1. Installing the Datadog Agent

Install the Datadog Agent by following the setup instructions for Windows hosts.

2. Enabling App and API Protection monitoring

Automatically enabling App and API Protection through Remote Configuration

You can enable remote configuration on your services dashboard. Simply check the box for the service you want to enable App and API Protection for under "Activate on your APM services".

Manually enabling App and API Protection monitoring

Download the latest Datadog .NET Tracer MSI Installer that supports your operating system and architecture and install it with Administrator privileges.

To enable AAP alongside with APM, add the following Environment Variables:

DD_APPSEC_ENABLED=true

To disable APM tracing while keeping App and API Protection enabled, add the following Environment Variables:

DD_APPSEC_ENABLED=true
DD_APM_TRACING_ENABLED=false

3. Run your application

Start your .NET application with the previous settings.

Restart IIS

net stop /y was
net start w3svc
# Also, start any other services that were stopped when WAS was shut down.
Note: The .NET runtime tries to load the .NET library into any .NET process that is started with these environment variables set. You should limit instrumentation to only the applications that need to be instrumented. Don't set these environment variables globally as this causes all .NET processes on the host to be instrumented.

Set the following required environment variables for automatic instrumentation to attach to your application and relaunch it:

COR_ENABLE_PROFILING=1
Note: The .NET runtime tries to load the .NET library into any .NET process that is started with these environment variables set. You should limit instrumentation to only the applications that need to be instrumented. Don't set these environment variables globally as this causes all .NET processes on the host to be instrumented.

Set the following required environment variables for automatic instrumentation to attach to your application and relaunch it:

CORECLR_ENABLE_PROFILING=1

4. Verify setup

To verify that App and API Protection is working correctly:

  1. Send some traffic to your application
  2. Check the Application Signals Explorer in Datadog
  3. Look for security signals and vulnerabilities

Troubleshooting

For a more detailed, see the Datadog Tracer installation guide for .NET Framework or the Datadog Tracer installation guide for .NET Core.

If you encounter issues while setting up App and API Protection for your .NET application, see the .NET App and API Protection troubleshooting guide.

Further Reading