Using configSource for appSettings and connectionStrings in web.config not working

articulate's Avatar

articulate

08 Dec, 2011 09:05 PM

I have the following sections in my web.config:

<appSettings configSource="AppSettings.development.config" />

<connectionStrings configSource="ConnectionStrings.development.config" />

This works when I deploy to a local IIS instance, however when I deploy AppHarbor this gets broken, because when the app is deployed it adds settings to the appSettings section of the web.config. This results in the following error (YSOD):

A section using 'configSource' may contain no other attributes or elements.

Is there a way I can deploy my code in AppHarbor with leaving my web.config the way that it is. Our web.config and the transformations are setup in the way that the are to facilitate development with our team.

Thanks,
Mark

  1. Support Staff 2 Posted by friism on 08 Dec, 2011 10:44 PM

    friism's Avatar

    Hi Mark

    We haven't encountered this problem before. We'll investigate and try to come up with a scheme that works for scenarios like yours.

    Thanks for reporting this.
    Michael

  2. 3 Posted by articulate on 09 Dec, 2011 03:43 PM

    articulate's Avatar

    I have a work-around for now, but I would like to go back to the other way. Please let me know when you have this figured out.

    Thanks,
    Mark

  3. Support Staff 4 Posted by tt on 09 Dec, 2011 03:49 PM

    tt's Avatar

    Are you using the .NET library to read the configuration values or do you also parse the files manually?

    I'm thinking that since we can't apply partial transformations, we could combine the configuration file into a single document before executing the transformations, but this will break anything that relies on the individual files.

  4. tt closed this discussion on 09 Dec, 2011 03:49 PM.

  5. articulate re-opened this discussion on 09 Dec, 2011 06:03 PM

  6. 5 Posted by articulate on 09 Dec, 2011 06:03 PM

    articulate's Avatar

    This is using the standard web.config processes. I have no code to read the secondary files. See this post: http://weblogs.asp.net/fmarguerie/archive/2007/04/26/using-configso... and this one http://www.nikhilk.net/Entry.aspx?id=158

    The only transformation that I am doing is to change the name of the entry in the configSource attribute to use the appropriate file. Here is what the transformations look like:

    <appSettings xdt:Transform="SetAttributes" configSource="AppSettings.production.config" />
    <connectionStrings xdt:Transform="SetAttributes" configSource="ConnectionStrings.production.config" />
    
  7. Support Staff 6 Posted by friism on 16 Dec, 2011 04:29 PM

    friism's Avatar

    Hi Mark

    If you add this is a suggestion on the feedback forum we'll extend the configuration file handling as soon as we find time.

    Michael

  8. 7 Posted by articulate on 20 Dec, 2011 01:26 PM

    articulate's Avatar
  9. Support Staff 8 Posted by friism on 20 Dec, 2011 01:41 PM

    friism's Avatar

    Great, we'll keep you posted.

    Michael

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

01 Aug, 2014 10:26 AM
01 Aug, 2014 04:43 AM
01 Aug, 2014 12:40 AM
01 Aug, 2014 12:35 AM
01 Aug, 2014 12:17 AM