Error in WCF Data Service
January 17, 2012 Leave a comment
I’ve been working on a small demo for a customer involving a WCF Data Service (blog post to come, hopefully) when my newly developed, and very simple, service insisted on returning – “The server encountered an error processing the request. See server logs for more details.”
This happened before any of my code executed directly, which buffeled me for a short bit, but then adding the [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)] attribute to the data service class revealed a little bit more detail –
The server encountered an error processing the request. The exception message is ‘On data context type ‘AzurePubsContext’, there is a top IQueryable property ‘list’ whose element type is not an entity type. Make sure that the IQueryable property is of entity type or specify the IgnoreProperties attribute on the data context type to ignore this property.’
My AzurePubsContext class did not have any public properties that do not return IQueryable, so this was not pointing directly at the problem, but it was clear that I have an issue with the entity I was using.
I was trying to represent pub’s roysched table, migrated to Azure Table Storage and I suspect my problem was that there was no obvious key the Entity Framework could use.
Specifying the [DataServiceKey(“PartitionKey”,”RowKey”)] attribute on my entity class sorted this quickly enough.