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 8536617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:42:38+00:00 2026-06-11T10:42:38+00:00

I’m having some trouble with EntityFramework (database first) and AppHarbor. I’m trying to use

  • 0

I’m having some trouble with EntityFramework (database first) and AppHarbor.

I’m trying to use the configuration string as inserted into the web.config by AppHarbor (I’ve added the metadata into the Sequelizer config option on the website), and I’m trying to add some additional values using code provided.

Currently I’m being a very bad person and embedding the string directly into my apps configuration provider – not good if the hosting provider switch DBs on us, so I’m looking to do it the proper way and use the values AppHarbor supply via the web.config.

This is the string as per provided by AppHarbor (passwords and server details removed):

metadata='res://*/MyDataEntities.csdl|res://*/MyDataEntities.ssdl|res://*/MyDataEntities.msl;';provider=System.Data.SqlClient;provider connection string='Server=servername.sequelizer.com;Database=databasename;User ID=username;Password=<snip>;'

If used “as is”, that generates the following error:

The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource.

I then use the following code (purloined off of one of the AppHarbor support discussions) to append the required extra things EF needs…

          if (String.IsNullOrWhiteSpace(ProductionDatabaseConnectionString))
            {
                // Get it on first read and cache it
                var configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
                var connectionString = configuration.ConnectionStrings.ConnectionStrings["SQLAppHarbor001"].ConnectionString;
                // Add the required extra metadata for EF4.x
                if (!connectionString.Contains("MultipleActiveResultSets=True;"))
                    connectionString += "MultipleActiveResultSets=True;";
                if (!connectionString.Contains("App=EntityFramework;"))
                    connectionString += "App=EntityFramework;";
                configuration.ConnectionStrings.ConnectionStrings["SQLAppHarbor001"].ConnectionString = connectionString;
                configuration.Save();
                ProductionDatabaseConnectionString = connectionString;
            }
            return ProductionDatabaseConnectionString;

That produces the connection string as follows:

metadata='res://*/MyDataEntities.csdl|res://*/MyDataEntities.ssdl|res://*/MyDataEntities.msl;';provider=System.Data.SqlClient;provider connection string='Server=servername.sequelizer.com;Database=databasename;User ID=username;Password=<snip>;'MultipleActiveResultSets=True;App=EntityFramework;

But that produces the error:

Format of the initialization string does not conform to specification starting at index 165.

Index 165 being the start of “provider connection string”.

The working connection string I use embedded, which currently works without issue, is:

metadata='res://*/MyDataEntities.csdl|res://*/MyDataEntities.ssdl|res://*/MyDataEntities.msl;';provider=System.Data.SqlClient;provider connection string='Server=servername.sequelizer.com;Database=databasename;User ID=username;Password=<snip>;multipleactiveresultsets=True;App=EntityFramework'

The only real differences being that the “multipleactiveresultsets=True;App=EntityFramework” entries are inside the “provider connection string” string rather than outside.

Other people seem to be using EntityFramework on AppHarbor using the supplied configuration variables fine, so what an I doing wrong?

  • 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-11T10:42:40+00:00Added an answer on June 11, 2026 at 10:42 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

    I came up against this today! I did the following:

    var configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
    var connectionString = configuration.ConnectionStrings.ConnectionStrings["ConnStringAlias"].ConnectionString;
    if (!connectionString.Contains("multipleactiveresultsets=True;"))
    {
        connectionString = connectionString.TrimEnd('\'');
        connectionString = connectionString += "multipleactiveresultsets=True;\'";
        configuration.ConnectionStrings.ConnectionStrings["ConnStringAlias"].ConnectionString = connectionString;
        configuration.Save();
    }
    

    The MultipleActiveResultSets property must be inside the provider connection string, which is why you received an error regarding the format of your connection string.

    I seen a few ‘solutions’ around but none seemed to work for me, including the solution at the bottom of a support page of how to do exactly this on AppHarbor’s site. The solution provided even sends the application into an infinite loop as the application will restart every time the web.config file is saved, which is every time in the example.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.