Geeks With Blogs


ThreadAbortException my experiments with //Web

I hit this error when I deployed an app built with Entity Framework onto Windows Azure.  Obviously, I wasn’t explicitly using DataReader so it kind of puzzled me.  As it happens every time Smile It worked well with local database, application running local and database on SQL Azure.  But once I used the Dev Fabric to test the application locally, it failed and gave the above error.

Entity Framework relies on using Multiple Active Results Sets (MARS), and it would be a part of connection string multipleactiveresultsets=True.  Earlier SQL Azure didn’t  support MARS, so we have to explicitly set it to “false” before deploying to SQL Azure.

But starting April 2010, SQL Azure supports MARS (yeah, that is the level of update I had on SQL Azure i..e 1 year late Smile) and this post nicely covers on this particular topic

On the new SQL Azure features, read 

In my case, I wired up the connection string myself using the Azure user account and password and totally forgot the MARS setting.

All I had to do was to add the multipleactiveresultsets=True to my connection string and it started working fine.

If you surface this error even after adding the above, and find some resolution, do post in the comments Smile


Posted on Tuesday, June 14, 2011 12:51 PM Windows Azure , SQL Server | Back to top

Comments on this post: Entity Framework with SQL Azure, "There is already an open DataReader associated with this Command which must be closed first."}

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Harish Ranganathan | Powered by: | Join free