We recently started using Octopus Deploy for our deployments. After the last deployment I got this strange error:
System.ArgumentException: Keyword not supported: 'data source'. Stack Trace: at System.Data.EntityClient.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Hashtable synonyms) at System.Data.EntityClient.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms) at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) at System.Data.Entity.Internal.LazyInternalConnection.Initialize() ...
The exception stack trace indicated that it had something to do with Entity Framework. I assumed the connection string could have been misconfigured on the server. We use the Configuration variables feature of Octopus Deploy to replace some connection strings in the web.config file.
The value for the connection string looked alright:
The connection string was for Entity Framework and had this value that contains another connection string inside quotes.
Then I had a look at the actual web.config file on the server. This showed something interesting in the connectionStrings section:
<add name="DataModelContainer" connectionString="metadata=[...] connection string=&quot;data source=[....]&quot;" providerName="System.Data.EntityClient"/>
Apparently the ‘"’ was encoded twice to ‘&quot;’. This was done when Octopus Deploy replaced the connection string value.
The solution was to not use the XML encoded value in Octopus deploy. So the ‘"’ had to be replaced with ‘"’.