none
Error Reading Encrypted Web Config RRS feed

  • Question

  • Any help is greatly appreciated.  Occasionally we are getting the below error when reading a connection string from a wcf service.  The connection string is encrypted.  There is no writing to the config file so error is very puzzling.

    Error Message:  An error occurred loading a configuration file: Collection was modified after the enumerator was instantiated. (D:TWF.BT.DataAccess.WCF\web.config line 33)

    Calling Code:  var c = new OracleConnection(ConfigurationManager.ConnectionStrings["TWF.CS.DATAACCESS.Persistance.DataContext"].ToString())

    Line 33 of web config is : <connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">

    • Moved by Fred Bao Thursday, October 30, 2014 1:27 AM Move to a more proper forum
    Tuesday, October 28, 2014 7:59 PM

All replies

  • Shouldn't it be: var c = new OracleConnection(ConfigurationManager.ConnectionStrings["TWF.CS.DATAACCESS.Persistance.DataContext"].ConnectionString); Using .ToString() might return the wrong result.
    Tuesday, October 28, 2014 9:03 PM
  • No, in this case ConfigurationManager.ConnectionStrings["YOUR CONNECTION STRING"] returns a string. so adding .ToString() is redundant
    Wednesday, October 29, 2014 1:23 PM