Upgrading to BlogEngine.NET 2.0

File & Folder Changes

There are more file and folder changes made in BlogEngine.NET 2.0 compared to the last couple of releases (i.e. versions 1.5, 1.6). Some files which existed in v1.6 no longer exist in v2.0. The web.config file has also undergone some relatively major changes and transformations. Additionally, because BlogEngine.NET 2.0 is now based on ASP.NET 3.5 (prior versions were ASP.NET 2.0), many changes related to this have been made in the web.config file.

Recommended Path to Upgrade

The cleanest way to upgrade to v2.0 is to start from a v2.0 installation, and then copy your existing data and settings into v2.0. The upgrade steps follow.

A couple of the steps are related specifically to those who use a database for storage, and a couple are related specifically to those who use the default XML storage (non-database). You can skip the steps that don't pertain to your method of storage.

1.  Backup

Make a full backup of your existing BlogEngine installation.  This is very important.  If anything goes wrong, you can always restore to your backup.

2.  Install v2.0

Install v2.0 on your computer, in a new folder.

3.  Web.config file (for non-database installations)

As noted above, because of the large number of changes to the web.config files, it is strongly recommended you use the web.config file that is included with v2.0.  If you have any custom settings in your existing web.config files (e.g. appSettings), it will probably be easiest to copy your custom settings into the BlogEngine.NET v2.0 web.config file.  If you have any custom settings, those can be copied into the v2.0 web.config file now.  Otherwise, you can just use the v2.0 web.config file as-is.

Running BlogEngine.NET in a .NET 4.0 Application Pool?

If so, instead of using the web.config file found in the root folder, you will need to use the .NET 4.0 web.confg file found directly in the /setup folder.  The name of this file is ASP.NET_4.0_Web.Config.

4.  Web.config file (for database installations)

If you will be using a Database for data storage, Web.config files you can use are located in the /setup/ folder.  Because of the large number of changes to the web.config files, it is strongly recommended you start from these sample web.config files, and copy your specific connection string into the sample web.config file.  For example, for SQL Server, in the /setup/SQLServer folder is a file named SQLServerWeb.Config.  For MySQL, the file is /setup/MySQL/MySQLWeb.Config, etc.  Copy this file to the blog root, delete the existing Web.config file in the blog root, and then rename this sample config file to Web.config (i.e. rename SQLServerWeb.Config to Web.Config).

Running BlogEngine.NET in a .NET 4.0 Application Pool?

If so, you will need to use the web.config file that is for .NET 4.0.  They are included in the same folders.  For example, for SQL Server, the .NET 3.5 web.config file is named SQLServerWeb.Config, and the .NET 4.0 web.config file is named SQLServer.NET_4.0_Web.Config.

At this point, the Web.config file you copied to the blog root and renamed contains a sample DB connection string.  The sample DB connection string will look similar to:

connectionString="Data Source=MySQLServer;User ID=user;Password=password;persist security info=False;initial catalog=BlogEngine;"

Replace this sample connection string with the connection string in your existing Web.config file.

If you have any other specific customizations to your existing Web.config file (e.g. appSettings), add those into this Web.config file.

5.  Database Upgrade Script (for database installations)

If you are using a Database to store your data in, you will need to run the DB upgrade script.  Each of the /setup folders has an upgrade script.  For SQL Server, it is MSSQLUpgradeFrom1.6To2.0.sql.  For MySQL, it is MySQLUpgradeFrom1.6To2.0.sql, etc.  Run this script in your existing DB.  If you are upgrading from a version prior to 1.6, you will need to first run the upgrade script(s) to get your DB up to v1.6.  For example, if you are upgrading from v1.5, you will need to first run the 1.5to1.6 script, and after that, run the 1.6to2.0 script.

6.  App_Data folder (for non-database installations)

In your v2.0 installation is the App_Data folder.  Delete the entire contents within the App_Data folder.  Once the contents have been deleted, you have will have an empty App_Data folder.

Copy all of the App_Data contents (files/folders) from your existing blog to the empty v2.0 App_Data folder.

7.  Theme folder, Robots.txt & Other Custom Files

If you have a custom theme, copy your custom theme folder into the v2.0 "themes" folder.  Similarly, if you have customized the robots.txt file, or if you have any other custom files/folders, copy those into the v2.0 folder you have been working on.

8.  Deploy to Web Server

Because you will have files on your web server that no longer exist (or have been moved) in v2.0, it is best to delete all of the BlogEngine.NET files and folders on your web server, and then upload the new v2.0 files and folders you prepared in the previous steps.

Please make sure you have a backup of everything you will delete (see step 1).

After you have deleted the BlogEngine.NET files/folder off your web server, upload the v2.0 files and folders you prepared in the previous steps.

9.  Check App_Data folder Write Permissions

If you deleted the App_Data folder in the previous deployment step, you may need to double check that Write permissions are still set on the new App_Data folder you uploaded.  Even if you are using the Database storage option, certain items such as files & images you include in your blog posts are still saved in the App_Data folder.  BlogEngine.NET can only save files in the App_Data folder if Write permissions are enabled for the ASP.NET account.

FAQs & Breaking Changes

Where did the Login page (login.aspx) go?

In prior versions, login.aspx was in the blog root.  This page has been moved to under the /Account/ folder.  It is now: 

/Account/Login.aspx

Custom themes and other custom components (e.g. widgets) might have the login.aspx page hard-coded.  You just need to update the path to the new location.

Namespace Changes & Error Messages

If your blog is using a Widget, Control or Extension that is not included with BlogEngine (i.e. a customized one), you will most likely receive an error message after upgrading to BlogEngine.NET 2.0 and running your website.  Fortunately, it is relatively easy to fix it.  For reference, the namespace changes are:

  1. All controls in the App_Code folder have changed namespaces from "Controls" to "App_Code.Controls".
  2. Extension related files (ExtensionSettings & others) are now in the BlogEngine.Core.Web.Extensions namespace (previously they were in no namespace).

The error messages to look out for, and the code fixes follow:

The type or namespace name 'WidgetBase' could not be found

This error will typically occur in widget.ascx.cs and edit.ascx.cs (the user control files each widget has).  The fix is to add the following "using" statement to the top of these two files.  Note, some widgets do not have a edit.ascx.cs file.

using App_Code.Controls;

The type or namespace name 'ExtensionSettings' could not be found

This error will typically occur in the .CS file for an extension in the App_Code\Extensions folder.  Some extensions have multiple .CS files that may need to all be updated.  The fix is to add the following "using" statement to the top of the extension .CS files that are having this error:

using BlogEngine.Core.Web.Extensions;

Unknown server tag 'blog:xxxxxx'

This error will typically occur for a control with a .CS file extension that is located in the App_Code\Controls folder.  The XXXXXX will be the name of the control, e.g. <blog:CategoryList>, <blog:RecentPosts>.  Most likely, this control has a namespace towards the top of the .CS file that looks like:

namespace Controls

The fix is to change the namespace to the following:

namespace App_Code.Controls

Last edited Jan 1, 2011 at 7:36 PM by BenAmada, version 8

Comments

jamesnr Apr 26, 2011 at 6:43 PM 
Hi. Am semi technical but after following the instructions for an upgrade, received the following. Deleted all files and recycled the app pool just in case, no joy. Any ideas why I may be getting the error? Many thanks!! PS not sure where to ask for assistance.

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

intLogic Mar 5, 2011 at 5:45 AM 
I am getting:
Url : http://intuitionlogic.com/default.aspx Raw Url : /default.aspx Message : Exception of type 'System.Web.HttpUnhandledException' was thrown. Source : System.Web StackTrace : at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.default_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) TargetSite : Boolean HandleError(System.Exception) Message : Operation could destabilize the runtime. Source : BlogEngine.Core StackTrace : at BlogEngine.Core.Utils.ParseEnum[T](String value, T defaultValue) at BlogEngine.Core.SecuritySiteMapProvider.IsAccessibleToUser(HttpContext context, SiteMapNode node) in E:\Projects\BlogEngine-HG-10\Source\BlogEngine\BlogEngine.Core\Security\SecuritySiteMapProvider.cs:line 35 at System.Web.SiteMapNode.IsAccessibleToUser(HttpContext context) at System.Web.StaticSiteMapProvider.GetChildNodes(SiteMapNode node) at System.Web.SiteMapNode.get_ChildNodes() at Admin.Menu.BindMenu() at Admin.Menu.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) TargetSite : T ParseEnum[T](System.String, T)

Have no idea how to fix it! I am not upgrading this is my first try at BE and I'm using Winhost.com.

Any help would be totally appreciated.

albertpascual Feb 21, 2011 at 11:44 PM 
I get this error after I deploy to my hoster
System.Security.VerificationException: Operation could destabilize the runtime.

BenAmada Dec 28, 2010 at 6:10 AM 
There's an unofficial Provider Migration tool you can use to migrate data from XML to SQL CE, or to (or from) any other provider.
http://www.nyveldt.com/blog/page/BlogEngineNET-Provider-Migration.aspx

mapitman Dec 27, 2010 at 11:54 PM 
Is there a way to upgrade from using XML to SQL CE? Any automated scripts to get all of your posts, etc. into the SQL CE DB?