Azure Tip – Demystifying Table Service Exceptions

A quick tip for when you’re trying to identify exceptions resulting from the windows azure storage services. Usually these look something like ‘The remote server returned an error: (400) Bad Request.’

Stating well… not much, just that you did something bad. Now how do you go by identifying what happened?

First of all, make sure you get the exception at it’s origin even if this is not in your code. You can do this by enabling visual studio debug on throw for the exception on System.Net.WebException

Now you can use your immediate window to extract the response body from the http response by issueing following command:

new System.IO.StreamReader(((System.Net.WebException) $exception).Response.GetResponseStream()).ReadToEnd()

The response you get back contains the error message indicating what is wrong. In my case one of the values I pass in is out of range. (sadly enough it does not say which one)

"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n<error xmlns=\"\">\r\n <code>OutOfRangeInput</code>\r\n <message xml:lang=\"en-US\">One of the request inputs is out of range.\nRequestId:ba01ae00-6736-4118-ab7f-2793a8504595\nTime:2011-07-28T12:36:21.2970257Z</message>\r\n</error>"

Obviously there are other errors as well, you can find list of these error types here:

But the one I got is pretty common, following docs can help you identify which of the inputs is wrong:

May this post save you some time 🙂

5 Responses to Azure Tip – Demystifying Table Service Exceptions

  1. Just for reference, in my case there was a / in the rowkey which is illegal

    • Oak Nguyen says:

      Thank you so much. Kept kepting a bad operation request and didn’t know why. Made my rowkey an url so it had the /.

  2. Pingback: Windows Azure and Cloud Computing Posts for 7/28/2011+ - Windows Azure Blog

  3. Pingback: Table Storage Hiccups | onefloridacoder's bit bag

  4. Dirk Boer says:

    FYI: I came across another solution: – seems to work pretty well for me!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: