MARS to the Rescue

WCF Concurrency

When you create a WCF web service you most likely want it to have a ConcurrencyMode of ‘Multiple‘ so that your service will scale. Check this out if you need some convincing on this.

Here’s an error I recently ran into when multiple threads started hitting my database:

There is already an open DataReader associated with this Command which must be closed first.

I’m using enterprise libraries Data Access Block and my DB is an SQL Server 2005. For once the fix was really easy, I just had to change my connection string to include MultipleActiveResultSets=True.

That’s it!

Check out this link that helped me figure it out and this MSDN article more details.

A nice easy immediate fix for a problem I thought would require some re-engineering. Why can’t all problems be like that 😐

Advertisements
  1. Dude! Just found your blog. Subscribed. How’s everything going on your side?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: