Web.config transformations
I typically use Web.config transformations in my Web Application projects to control settings in my Web.config files specifically for deployment scenarios between development, staging and production.
I noticed that the connection string information is now stored in DataConfig.config instead of in the Web.config file. I also did not seen an include element for the connectionStrings element in the Web.config file.
Therefore, how do you support standard Web.config transformations in Web Application projects in Sitefinity v. 4.x since non-Web.config files do not support Web.config transformations by default through Visual Studio 2010?
Hi Samir Vaidya,
Yes, Sitefinity stores the connection strings in the DataConfig.config by default, however having the connection string in the web.config is also supported.
So, you can move the Sitefinity connection string from DataConfig.config to the the web.config in order to take advantage of the transformations feature.
If you do this, consider the followong:
1. If you have connection strings with the same name in the DataConfig.config and web.config, those one in the web.config will be ignored.
2. The connection string in the DataConfig.config has an attribute 'dbType', which is not supported by the connection string element in the web.config. This attribute can be included as a parameter in the connectionString.
For example, if you have this connection string in the DataConfig:
<
add
connectionString
=
"data source=xxx;Integrated Security=SSPI;initial catalog=xxx"
providerName
=
"System.Data.SqlClient"
dbType
=
"MsSql"
name
=
"Sitefinity"
/>
<
add
connectionString
=
"data source=xxx;Integrated Security=SSPI;initial catalog=xxx;Backend=mssql"
providerName
=
"System.Data.SqlClient"
name
=
"Sitefinity"
/>
Hi Vlad,
I'm trying to use web.config transformations to connect to my SQL Azure database. I've removed the connection string from dataconfig.config file and moved into the web.config but I get the error saying:
Wrong database backend configuration detected: Connecting to 'Microsoft SQL Azure (RTM) - 11.0.9041.121
Apr 24 2013 16:44:15
Copyright (c) Microsoft Corporation
' but configured for 'mssql'.
My connection string is set as mentioned in the thread above but seems that it doesn't understand the Backend=Azure part of the connection string.
Web.config -
<add name="Sitefinity" connectionString="Server=abc.database.windows.net;User ID=admin@abc;Password=@Bc123;Database=MyDbStaging;Trusted_Connection=False;Encrypt=True;Backend=Azure" providerName="System.Data.SqlClient" />
Hello David,
The connection string should be:
<add name="Sitefinity" connectionString="Server=abc.database.windows.net;User ID=admin@abc;Password=@Bc123;Database=MyDbStaging;Trusted_Connection=False;Encrypt=True;Backend=SqlAzure" providerName="System.Data.SqlClient" />
Greetings,
Nadezhda Petrova
the Telerik team