Deborah's Developer MindScape






         Tips and Techniques for Web and .NET developers.

September 23, 2012

Using IE 9 and F12 to Debug your Web API Service

Filed under: ASP.NET,ASP.NET Web API,C#,VB.NET @ 7:39 pm

Internet Explorer 9 allows you to see the HTTP request and response information using the F12 developer tools. This can be useful when debugging or testing your ASP.NET Web API service.

[See this prior post for an introduction to building an ASP.NET Web API service. The service created in that post is the example service used here.]

Start your Web API Service in Visual Studio, viewing it in Internet Explorer 9.

image

I always forget which key to press for the F12 developer tools, but if I recall correctly, it is F12. 🙂

The tool window appears as shown below:

image

Select the Network tab and click the Start Capturing button to start capturing the HTTP request and response information. Then select the browser window and add "api/customer" (or "api/customerVB" for the VB service) to the address bar. Cancel the request to open or save the result.

Returning to the F12 window, you will see the HTTP request:

image

Select the api/Customer entry and click the Go to detailed view button. From there, you can view the Request header to see more details on the request. Click the Response body to see the response:

image

Right-click on the body and select Word Wrap from the context menu to view the JSON in a nicer layout:

image

Use the F12 tool whenever you need to debug or test your Web API service or any client calling your Web API service.

Enjoy!

3 Comments

  1.   Richard — September 28, 2012 @ 1:05 pm    Reply

    I tend to use Fiddler instead. You don’t even need to use a browser – you can issue any HTTP request you want from within the tool.

    http://www.fiddler2.com/fiddler2/

  2.   DeborahK — September 28, 2012 @ 1:39 pm    Reply

    Hi Richard –

    Yes, I meant to do an example with Fiddler as well. Have not yet taken the time to write it up.

    Thanks for the reminder!

  3.   John Sheehab — June 16, 2013 @ 10:35 pm    Reply

    We’ve built a new set of free tools to make API debugging easier. Try it out at https://www.runscope.com

RSS feed for comments on this post. TrackBack URI

Leave a comment

© 2019 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs