Replacing encrypted connection string RRS feed

  • Question

  • User934454138 posted

    I'm using a web deployment project in which I specify that it should replace the connectionStrings section of the web.config upon deployment, because we use a different connection string for remote and local.

    The problem is, we are encrypting the connection string in the web.config using aspnet_regiis.  So I generated an encrypted version of the remote connection string and put it in my replacement file, "conStrings.config".  But when I try to compile in Release mode, I get the following error:

    web.config(12): error WDP00001: section connectionStrings in "web.config" has 1 elements but "conStrings.config" has 3 elements.

    I guess the "3 elements" are the EncryptedData, CipherData, and CipherValue tags in the connectionStrings section. But the encrypted value in the web.config also has these 3 elements. Does this mean the deployment project decrypts the connection string before replacing it?

    How can I get it to replace the connection string with a different value, but have the different value encrypted?  Is it even possible?


    Monday, December 10, 2007 1:52 PM


  • User-2017008401 posted

    Hi Cynthia,

    Based on my test, there is an option (checkbox): “Enforce matching section replacements” under the “Web.config file section replacements” text area. I can reproduce the error if I check that option and rebuild the web deployment project. Please uncheck that option in your deployment project. I hope it is helpful.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 13, 2007 8:44 PM