More things that I have learned with Azure
I've been working on this application to run on Windows Azure. I wanted to share a few things that I have learned. I'm not sure if I have missed these being covered else where, but I want to bring them up here for my own knowledge. I find that I remember things much better if I blog them than if I put them on twitter.
- Resource not found for the segment 'ObjectTableName." Steve Smith has a good blog post on this at http://stevesmithblog.com/blog/azure-table-storage-gotcha/. I got this message, followed Steve's instructions and bang, still go the message. WTF is that about! Anyway, I found that I had to reset the table storage through the azure development storage applet and then recreate the tables from the objects in Visual Studio. Once I did that, things seemed to work better. Yippee!
Another note, that you can get this error when you operate on a LINQ query that returns no objects.
- I was running queries that were not returning any data. WTF is that about! Then it hit me, LINQ doesn't return data until you actually ask for that data. I need to force LINQ to send me some data in some situations. How can I force this to occur? I saw that some of my queries were returning data and some were not. I started playing around and found that if I called .ToList<T>() after my query that the data always came back to me. I figure that was a step in the right direction.
- Azure Development Tools use Sql Server Express on the local development machine to store data during development. I decided to look and see what is happening. Guess what, you can connect up and see your data just like you thought you could in any application. Also, you can use Sql Server tools to see WTF is going on. I used that to figure out the issue above.
- DateTime.Now vs. DateTime.UtcNow. Have you used DateTime.Now in an Azure query? It works just fine when you are running in the local development fabric. Deployed to the azure hosted fabric and I got an error. You can't quite connect VS.NET to the hosted fabric to see what is going on. After lots of testing, I changed the query I was doing to use DateTime.UtcNow andlow and behold my app started posting messages to twitter from the hosted fabric.
Original Url: http://morewally.com/cs/blogs/wallym/archive/2009/03/25/more-things-that-i-have-learned-with-azure.aspx