Thursday, December 03, 2009

Windows Azure Tables

I spent around 1 hour trying to resolve an error that i received while trying to query a table in Windows Azure Tables, the query was something like this

this.Users.Where( s=> s.UserID==userID).ToArray();

the error i received


System.Data.Services.Client.DataServiceQueryException was unhandled by user code
Message="An error occurred while processing this request."

InnerException: System.Data.Services.Client.DataServiceClientException
Message="<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\r\n
<error xmlns=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n
<code>InvalidInput</code>\r\n
<message xml:lang=\"en-US\">One of the request inputs is not valid.</message>\r\n
</error>"


after some research i found the following in the Azure SDK

Characters Disallowed in Key Fields
The following characters are not allowed in values for the PartitionKey and RowKey properties:

  • The forward slash (/) character
  • The backslash (\) character
  • The number sign (#) character
  • The question mark (?) character

My key field had some slashes :(

My bad !!, but in my defense the error message was not very clear :)

2 comments:

John Morrill said...

This helper me solve a similar problem. In my case the entities I defined in my Context inherited from other entities. It would appear the query client cannot use properties in the base classes as query parameters.

Даня said...

thx!!!
In my case problem was in Partition Key, similar name with other pk name.
thx!