+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Web.config transformations

Web.config transformations

4 posts, 1 answered
  1. Samir Vaidya
    Samir Vaidya avatar
    261 posts
    Registered:
    05 Feb 2005
    23 Jul 2011
    Link to this post
    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?

  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    26 Jul 2011
    Link to this post
    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" />

    It should be  moved in the web.config as:
    <add connectionString="data source=xxx;Integrated Security=SSPI;initial catalog=xxx;Backend=mssql" providerName="System.Data.SqlClient" name="Sitefinity" />

    In case you are using MSSQL, you can skip this parameter, because 'mssql' is the default. Currently, the supported values for the Backend parameter are: mssql, oracle, mysql, azure.

    Hope this is helpful.

    Best wishes,
    Vlad
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. David
    David avatar
    2 posts
    Registered:
    10 May 2013
    17 May 2013 in reply to Vlad
    Link to this post
    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" />

  4. Nadezhda Petrova
    Nadezhda Petrova avatar
    20 posts
    Registered:
    28 Oct 2016
    21 May 2013
    Link to this post
    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
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
4 posts, 1 answered