If you are building an ASP.NET Web API and want a view into the HTTP traffic that is hitting your API then this is a really quick solution that might prove useful.
Runscope is a cloud based service that allows you to monitor, measure and test Web APIs. By using their API I was able to build a HttpMessageHandler that logs all requests and responses to the service. Runscope has a free tier that allows you to log 10K requests/month.
Add a messagehandler
In your Web API project, simply add the Nuget package Runscope.HttpMessageHandler
and the following line of code in your Web API configuration code:
config.MessageHandlers.Add(new RunscopeApiMessageHandler(<ApiKey>,<BucketKey>);
You can get an APIKey by creating an Application within Runscope and the bucket key is displayed at the bottom right hand corner of the page.
And you’re done.
Get results immediately
Once you start making requests to the API you will be able to see the details of the request in the Runscope Traffic Inspector,
and the response…
Let me show you how
The following demonstrates how to create a Web API, setup a Runscope account and add Runscope logging to it in less than 5 mins.
Image credits : Heart rate monitor https://flic.kr/p/8S3ofm
Image credits : Stopwatch https://flic.kr/p/6xSoka