---
title: "Does Retrace Support Web API"
slug: "net-agent-installation-configure-self-hosted-web-api"
description: "Retrace automatically supports Web API transactions that are hosted within an IIS application. If you are \"self hosting\" Web API in a Windows Service, please use these directions."
updated: 2018-07-12T14:52:50Z
published: 2018-07-12T14:52:50Z
---

> ## 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.

# Self Hosted Web API

Retrace automatically supports Web API transactions that are hosted within an IIS application. If you are "self hosting" Web API in a Windows Service, please use these directions.

## Step 1. Configure Retrace to know about and profile your application

By default Retrace only profiles IIS applications. Please review this article on how to tell it to profile your application: [.NET Agent Installation: Configure Windows Services](https://docs.stackify.com/docs/net-agent-installation-configure-windows-services)

## Step 2. Add the Stackify Web API Message Handler nuget package to your application

Web API can be self hosted in a Windows Service or console app, outside of IIS. A Message Handler needs to be added to your code and can be installed via a nuget package. This Message Handler allows Retrace to recognize when transactions begin and end. Find the nuget package download here: [Stackify Web API Message Handler](https://www.nuget.org/packages/StackifyWebApiMessageHandler/)

Via nuget:

```
Install-Package StackifyWebApiMessageHandler
```

Your code will look similar to the example below. You only need to add our Message Handler.

```csharp
public void Configuration(IAppBuilder app)
{
    // Your code sort of looks like this in Startup.cs but probably much more complicated
    var config = new HttpConfiguration();
    config.MessageHandlers.Add(new StackifyWebApiMessageHandler.RequestTracer()); <-- add this line
    app.UseWebApi(config);
}
```
