WebApi exception tracking

Jason FauchelleProvider UpdatesLeave a Comment

Our Raygun4Net provider has recently been upgraded to support WebApi projects. This includes pure WebApi projects as well as ASP.Net projects that include WebApi. This is available right now in the latest version of the NuGet package. Just like all Raygun.io providers, it is extremely easy to set up in just a few minutes.

WebApi exception tracking

Not only will Raygun4Net register an exception-logger, it will also add a custom exception-filter, action-filter, controller-activator, controller-selector and action-selector that can detect exceptions that never reach the exception-logger.

Installation and usage

As with all .Net projects, the easiest way to start using Raygun is to install the NuGet package. To do this, right click your project in Visual Studio and select “Manage NuGet packages…”. Then search for “Raygun4Net” and either install the standard or signed version depending on what you need. NuGet will automatically reference the correct dll that contains new classes specific for sending exceptions from a WebApi project.

The set up starts off exactly the same as when setting up Raygun4Net in an ASP.Net application. First add the following section to the configSections tag of the Web.config file:

Next, add the RaygunSetting tag in the Web.config file and specify your application API key. This API key is given to you when you create a new application in your Raygun.io account. You can also view this key in the application-settings, or in your applications list.

And last off, call the static RaygunWebApiClient.Attach method within the Register method of your WebApiConfig class:

This will cause Raygun4Net to send all unhandled exception information to your Raygun.io dashboard.

And that’s it!

If you need exception tracking for your WebApi projects, grab the latest version of Raygun4Net from NuGet now. If you don’t have Raygun yet, sign up for a free 30 day trial – no credit card required.

Next level software intelligence across your entire stack.

Leave a Reply

Your email address will not be published. Required fields are marked *