More in this section
Blogs RSS feed

Moving configurations to database

by User Not Found

With the release of Sitefinity 4.0 we have moved from storing Sitefinity related configurations in web.config to providing our on configuration persistence in the Sitefinity config files.This is the default setting for storing configurations and all of your settings are stored in the ~/App_Data/Sitefinity/Configuration/. When we released our support for multiple instances on Windows Azure we had to allow users to store configurations in the database, otherwise your Azure instances would not run with the same settings if you made any changes in the Administration -> Settings area of Sitefinity.This feature allows you to set up your Sitefinity website to store all configurations in the database, it can be used on non-Azure projects. Here is how you can set up database configurations storage:

1) Create a new project with the Sitefinity Project Manager. Instead of opening the project in the browser to set it up, open it in Visual Studio.

2) After you have opened the project in Visual Studio and go to your web.config file. Uncomment the telerik configuration section:

<sectionGroup name="telerik">
  <section name="sitefinity" type="Telerik.Sitefinity.Configuration.SectionHandler, Telerik.Sitefinity" requirePermission="false" />

Set up your database storage mode:

    <!--<environment platform="WindowsAzure"/>-->
    <sitefinityConfig storageMode="Database" />

After this operation you can run the project in the browser and instantiate it. It will create a connectionString setting in your web.config which will point to your database. Please note that for this operation you need to have the website identity be able to write/modify the web.config file. When the website is created there will be only two files in ~/App_Data/Sitefinity/Configuration. Those files will be ProjectConfig and SecurityConfig.

If your environment does not allow writing to the web.config file you can fist set up the project and then go to setting configurations to be stored in database. If you choose this approach, you will have the a few files in ~/App_Data/Sitefinity/Configuration that are created when the project is instantiated. Those files contain default configurations created when each project is ran for the first time and are necessary for the project's proper operation. You can eliminate the DataConfig file by moving your connection string to the web.config file as Vladi has outlined in this forum post.Any further configuration change will be persisted in the database.

This approach is very useful in a number of scenarios, for example setting up the project in NLB environment and using different file systems for each load balanced server. You can also prevent exposing SMTP settings in the config files, LDAP connection strings as well as other sensitive information.


Leave a comment
  1. Viktor Dec 12, 2011
    We have used this approach to set up our development environment. We currently have two development machines pointing to the single database. All the configuration is stored in the database (apart from connection string of course). Please note, that we had to switch off OpenAccess caching and move other caching into the database, rather then use in-memory caching. We should be able to turn OpenAccess caching back on once we set up our load balanced environment.
  2. DRock Jan 10, 2012
    Is there anyway to do this for an existing site?
  3. John Budd Mar 26, 2012
    I have posted on one of the articles here. Again, I have been left behind with the new add ons and features of sitefinity. This movement of database config is new to me. I have the same question as DRock. I have an existing site and I'm also wondering if this is feasible to do in an existing site.
    Jonathan Budd
    J. Budd Review
  4. Chetan Oct 18, 2012
    Hi Radoslav,
    This looks interesting to me as we are also facing some trouble because of the App_Data folder needing read/write permission access. In our web farm (as per firm standards) we do not allow App_Data folder to be writable. So we are looking out some other option through which we can put this configurations somewhere else (may be on Network share or in Database as you have suggested). 
    Could you please elaborate more on how does these files reside in SQL Databse & post some samples configurations files(examples if any) on your approach above. 
    This would be of great help for us.
  5. Chetan Oct 22, 2012
    As DRock & John mentioned , do we know how to achieve this for an existing site ? Will this create any further issues in an existing setup (a default one) ?

  6. Andrew Mar 26, 2013
    I second what was asked above, how can this be done for an existing site?
  7. Andrew Mar 27, 2013
    I second what was asked above, how can this be done for an existing site?
  8. Mark Dec 09, 2013
    Ditto above...we also would like to do this for an existing site.

    Leave a comment