Using IE 9 and F12 to Debug your Web API Service

Posted Sun, Sep 23 2012 17:39 by Deborah Kurata

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!

Filed under: , , , ,

Comments

# Interesting Finds: September 24, 2012

Monday, September 24, 2012 5:55 AM by Jason Haley

Interesting Finds: September 24, 2012

# Adding Simple Exception Handling to your Web API Service

Tuesday, September 25, 2012 1:47 AM by Deborah's Developer MindScape

There is nothing perfect in life, not even an ASP.NET Web API service. The service may not understand

# re: Using IE 9 and F12 to Debug your Web API Service

Friday, September 28, 2012 1:05 PM by Richard

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.

www.fiddler2.com/fiddler2

# re: Using IE 9 and F12 to Debug your Web API Service

Friday, September 28, 2012 1:39 PM by Deborah Kurata

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!

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: