Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7980789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:10:44+00:00 2026-06-04T10:10:44+00:00

this is my first question at stackoverflow, so bear with me. In my local

  • 0

this is my first question at stackoverflow, so bear with me.

In my local project I use ASP.NET MVC 3 and Entity Framework 4.3 with SQL Express.

in my connection string i have MARS set to true;

but when i am deploying my project on to Appharbor, Appharbor injects its own connection string,

where MARS is not set in the connectionstring. So i get this:

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first. 

So far best solution i have seen on this: http://support.appharbor.com/kb/add-ons/using-sequelizer

where they have this code:

var configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
var connectionString = configuration.ConnectionStrings.ConnectionStrings["ConnectionstringAlias"].ConnectionString;
if (!connectionString.Contains("MultipleActiveResultSets=True;"))
{
    connectionString += "MultipleActiveResultSets=True;";
}

configuration.ConnectionStrings.ConnectionStrings["ConnectionstringAlias"].ConnectionString = connectionString;
configuration.Save();

I can not figure out where to place this, have tried to put it in global under

Aplication_Start() method

But that gives me this error:

Server Error in '/' Application.

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 


Line 50: 
Line 51:             var configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
Line 52:             var connectionString = configuration.ConnectionStrings.ConnectionStrings["ConnectionstringAlias"].ConnectionString;
Line 53:             if (!connectionString.Contains("MultipleActiveResultSets=True;"))
Line 54:             {

Source File: C:\Users\William\Documents\Visual Studio 2010\Projects\xxx\xxx\Global.asax.cs    Line: 52 

Stack Trace: 


[NullReferenceException: Object reference not set to an instance of an object.]
   Educationexpander.MvcApplication.Application_Start() in C:\Users\William\Documents\Visual Studio 2010\Projects\xxx\xxx\Global.asax.cs:52

Is there anyone out there with a solution to this problem ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:10:46+00:00Added an answer on June 4, 2026 at 10:10 am

    Update: Multiple Active Result Sets (MARS) can now be enabled for the injected connection string by using the Sequelizer admin panel. This is the recommended approach since the web.config no longer needs to be modified, which causes an AppDomain reload during startup

    Answer is in the above comments, this is just to formalise.

    You need to use the correct ConnectionstringAlias (thanks @chris-sainty) and you have to enable file system writes in application settings for the updated configuration to be written to disk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my very first question on Stackoverflow, so please bear with me if
This is my first question asked here at stackoverflow, so bear with me please
this is my first question to stackoverflow so here it goes... I use cruise
this is my first question in stackoverflow. I am trying to use PHPExcel to
Greetings everyone. This is my first question here at stackoverflow so please bear with
This is my first question on stackoverflow. I just wonder why my getJSON code
This is my first question ever here on stackoverflow! I've been searching for a
First of all, sorry if this isn't an appropriate question for StackOverflow. I've tried
This is my first time using stackoverflow for a question that I need to
This is my first here in Stackoverflow. So I just want to ask question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.