Click here to Skip to main content
14,921,745 members
Articles / Web Development / ASP.NET
Article
Posted 14 Sep 2008

Tagged as

Stats

21.2K views
81 downloads
19 bookmarked

Running multiple instances of BlogEngine 1.4.5 with single db

Rate me:
Please Sign up or sign in to vote.
1.00/5 (4 votes)
14 Sep 2008CPOL2 min read
BlogEngine is a powerful blogging engine and there may be situation in which you would like to use it for multiple websites but one database.

Introduction 

BlogEngine is a powerful blogging engine and there may be situation in which you would like to use it for multiple websites but one database. One straight solution is to use different table prefix and specify the same in web.config file in appsettings. But I personally don’t like the idea of storing data in two different tables.Given the fact that I am using Asp.Net membership provider, I would like to leverage built in capabilities of membership provider to run two different applications having one single database. So here are the steps involved in running multiple sites with one database, assuming you are using Asp.Net membership provider.

Step1: Configure BlogEngine to use MSSQL and Asp.net membership provider

Users already using MSSQL provider can move to step 2 directly.

If you can access your hosted database remotely you can directly use the aspnet_regsql tool to install all required tables, views, storedprocedure etc. Otherwise use aspnet_regsql tool to create the database locally and then create a script necessary to create the tables, views and stored procedures etc so that the same may be run on the remote hosted site. To see step by step guide see this video

http://nyveldt.com/misc/BE13SQLMembership.html

After you have successfully configured to use MSSQL provider you will be able to see following page.  


Step2: Configure BlogEngine to use ApplicationId across the application.

  2.1 Run the MultipleInstanceScript.Sql file. Be sure to check the application name by default it has name ‘BlogEngine’ If you have different application name change the string. The scripts add ApplicationId column to all the tables of BlogEngine.

  2.2 Include DbMultiBlogProvider.cs in your BlogEngine.Core/Providers/ Folder.

Change following settings in web.config file.  

 

Note the extra applicationId attribute of DbMultiBlogProvider. Just check your aspnet_applications table and put the same applicationId value here. Well being lazy I have use ApplicationId instead of application name.  

Add following values in Appsettings values  

 

 

Here IsPrivateBlog attribute is used to identify if anonymous access is allowed or not. Comment explains everything.

That’s it.

If you want to deploy the same application with a different address Just create a new application through visual studio site administration tool and change the applicationId to the newly created applicationId. The script file and class file is attached with the post. In case you have any difficulty in setting up website do let me know.

Hope this helps.  

PS: The same article has been posted to my blog on http://noesispedia.com

History 


 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

pkmishra
Team Leader
India India
No Biography provided

Comments and Discussions

 
QuestionFeature, bug, or my error? Pin
cscuser4-Feb-09 16:21
Membercscuser4-Feb-09 16:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.