my6solutions

asp .net, the social web & other distractions

 

Running Apps

Disclaimer

I am in no way affiliated with Microsoft or Google. I am just another developer trying to make a difference. All opinions and observations are usually my own.

Windows Azure : Resource not found for the segment 'ObjectTableName' exception

I hope the following will save some people time. The above exception occurs while developing using the July 2009 CTP of Windows Azure. The following query throws the above exception when the oauthConsumers table has no entry. I have not checked if it will occur if there is already an entry in the table or whether it occurs when published to the cloud.

var result = db.oauthConsumers.Where(x => x.PartitionKey == "user" && x.RowKey == userId).SingleOrDefault();

I had tried doing the following the solve the above problem

  1. Press the huge Reset button in the Development Storage tool.
  2. Delete the Test Storage tables created in SQL Express and recreated them.
  3. Checked, double-checked, and triple-checked the entity declarations and table names.
  4. Various combinations of the above.

But no joy. It turns out that the above query should be written as follows

var result = db.oauthConsumers.Where(x => x.RowKey == userId && x.PartitionKey == "user").SingleOrDefault();

??!??!! I'm not going to dig any deeper into this but an explanation to why the above fixes the exception would be great.


 

 

 

 

Bookmark and Share

Categories: ASP .NET | Windows Azure
Permalink | Comments (1) | Post RSSRSS comment feed

Comments

Peter Jones

Thursday, October 15, 2009 5:00 AM

Peter Jones

Thanks!  I found exactly the same problem.  Weird!