BlogEngine.NET configuration for SQLite Providers

This is a quick rundown of the changes required for gettting BlogEngine.NET work with SQLite.

  1. Get log4net ( and SQLite ADO.NET Provider (
  2. Change “blogProvider” to SQLiteBlogProvider
    <blogProvider defaultProvider="SQLiteBlogProvider">
    <add name="SQLiteBlogProvider" type="BlogEngine.Core.Providers.SQLiteProvider.SQLiteBlogProvider" />
  3. Set role and membership providers to SQLite. Remember that you should set the applicationName as soon as possible (trust me, I got burnt a few times by not doing so).
    <membership defaultProvider="SQLiteMembershipProvider">
    <!-- <add name="XmlMembershipProvider" type="BlogEngine.Core.Providers.XmlMembershipProvider" description="XML membership provider" xmlFileName="~/App_Data/users.xml"/> -->
    <add name="SQLiteMembershipProvider"
    applicationName="/Codoxide" />
    <roleManager defaultProvider="SQLiteRoleProvider" enabled="true">
    <!-- <add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider" description="XML role provider" xmlFileName="~/App_Data/roles.xml"/> -->
    <add name="SQLiteRoleProvider"
    applicationName="/Codoxide" />
  4. Setup log4net appender of your choosing.

The above is obviously a very lazy piece of documentation. It’s only there to serve as a guide for you to understand the projects web.config file where you’d find the complete customization requried.

Changes affecting sql.config

I have used the sql.config file that was used by the SQLBlogProvider with few modifications. Firstly, the connectionString attribute  is set to “Data Source={0}\blogengine.db”. The SQLite provider requries that the data source contains the full path to the SQLite database. Therefore, the above string is used as the pattern for a string.Format operation where {0} receives the absolute file system path to app_data folder.

You will also notice an additional tag for “BlogEngine_LocalPath”, which contains an absolute path to the SQLite db file. Now, unlike the default XML provider in BE.NET, I’ve been too lazy to include a default user account into the database. So, you’d have to use ASP.NET Web Site Administration Tool to create user accounts. When invoked through the Admin Tool it becomes impossible to use Server.MapPath as the current HTTP Context turns out to be null. The “BlogEngine_LocalPath” element is there to be used in this situation.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.