Setting up BlogEngine.NET 1.4 to use SQL Server

-   Jul 02, 2008 -   BlogEngine.NET, Screencasts -   , , ,

BlogEngine.NET 1.4 supports storing your data pretty much however you’d like.  By default, it will store your data using XML.  However, with a few simple steps you can be running your entire blog off of a database.  Today, I put together a new screencast to show you exactly how to configure your blog to use SQL Server.  For the veterans out there, there is some key changes in BlogEngine.NET 1.4, so it should be worth watching for you as well. It is important to point out that this screencast starts with BlogEngine.NET 1.4 installed with the default providers.  If you need help getting to that point, please watch the installing BlogEngine.NET 1.4 screencast. It is important to know that BlogEngine.NET actually has 4 providers that can be configured. Blog Provider – Store posts, pages, settings, etc. Membership Provider – Store user names, passwords, etc. Role Provider – The role the users are in.  (Administrator, Editor) Profile Provider – Information about the users. This new screencast will walk you through getting the BlogProvider and the ProfileProvider setup using the new DbBlogProvider and DbProfileProvider.  For SQL Server, I’d recommend using the SQLMembershipProvider and the SQLRoleProvider that are built in to the .NET Framework.  I made a screencast a while back on getting these set up, so I figured I’d save the effort and just link to it again for setting up these providers.  Nothing has changed in the configuration.

 BlogEngine.NET 1.4 Upgrade Guide

-   Jun 30, 2008 -   BlogEngine.NET -   , ,

This was fairly popular last time around, so I wanted to write this up and make sure it was available right away with the new 1.4 release.  The upgrade process is fairly easy but there are a few things to be aware of.  Hopefully, I’ll cover everything you could possible want to know on your journey from BlogEngine.NET 1.3.x to BlogEngine.NET 1.4. 1. Backup your stuff If you read this last time, you realize that there is no warranty with my guide and you are strongly encouraged to backup your blog and blog data. At a minimum, please backup your App_Data folder, any custom themes or extensions you may have, and your web.config especially if you are a database user. 2. Download BlogEngine.NET 1.4 (website) This is likely the step you have already done.  (If not, get it here.)  Once you have it located on your PC, unzip it.  Right click the folder, go to Properties and remove the Read Only check.  (This step has helped some and has never hurt anyone.) 3. Update your database If you are using the the MSSQL Provider and have your blog data stored in SQL Server, we have an upgrade script for you to run.  It adds a few more tables and some basic data for them.  The script is found in the Setup folder of the blog and it is labeled MSSQLUpgrade1.4.0.0.sql.  Run this against your BlogEngine database. 4. Configuration… as in Web.Config If you are a database user, you are going to have to make some updates to the web.config that you are about to upload. First thing, you will want to add your connection string to the new web.config in the connectionStrings section. Second, you will notice that the MSSQLBlogProvider is gone.  (Its ok.  It has gone to a better place.)  It has been replaced with the DbBlogProvider.  This is your new friend.  Make sure you have your connection string name marked here and set the DbBlogProvider as your default BlogProvider.  Save your changes.   5. Upload your files This is a little bit tricker this time around so pay attention. First, make sure you have a good backup from step #1.  This is really your last chance to do that. Now, you can upload everything except the App_Data folder.  It is important to note that a few things have moved around and if you just choose to overwrite files, you’ll have some left overs.  These leftovers should not cause problems for you (except noted in the troubleshooting section) but they just take up space, most notably the tiny_mce folder under the admin folder has been moved and can be deleted. Once you have most files moved up, it is time to go into your app_data folder.  In the downloaded project, you will see two new folders, datastore and profiles.  Upload these to your site as well.  (If you use a database for file storage, it isn’t require, but it is consistent.) 6. Security Update If you use the default XMLMembership provider to store your passwords, this has been updated in in 1.4.  We had been storing the password in clear text and this is no longer the default.  If you wish to continue with clear text, you can set your XMLMembershipProvider passwordFormat to Clear in the web.config, but this is not recommended. Since BlogEngine.NET 1.4 is looking for hashed passwords by default, you’ll be unable to log in unless we make a change to your user data.  You’ll need to retrieve your users.xml file from your app_data folder.  You should be able to see your users and passwords listed in the file.  Remove the password from each entry user so it has an blank or empty password and save the file.  Upload your newly edited file to your site when you are done. This will cause BlogEngine to allow you to log in with each user using the password “admin” so that you can then change the password to whatever you’d like.  The new password will be hashed. 7. Fire it up Ok, now that we have everything out there, let’s run it.  Point your browser back to your blog and after a few moment wait as your site compiles, you should see your blog back as you’d expect it.  (If your blog doesn’t come up, see the troubleshooting section below.) Now that you are up, first log in and use the change password option on your admin menu to change your password to something secure. 8. Check your settings Everything is done, but it is always a good idea to Check your settings and make sure everything is configured properly.  This would also be a great time to fill in your profile for FOAF support. Troubleshooting Hopefully, you are just reading this because you want to see what other poor souls are struggling with.  The typical things that are going to cause trouble are custom themes and extension that were made prior to 1.4.  If you have any installed remove them and try again.  If you are still having trouble, try going into your settings.xml or be_Settings table and changing the default theme to be Standard. If you are having trouble logging in to your blog, try an application restart. If you have more tips or additions, please make them in the comments and I’ll update this post.

 BlogEngine.NET Screencast: SQL Membership and Roles Providers

-   Jan 07, 2008 -   BlogEngine.NET, Screencasts -   , , , ,

The third screencast in my recent series is a walk through of setting up the SQL Membership and Roles providers in place of the default XML versions.  These SQL providers are built-in to the .NET 2.0 framework and are not BlogEngine.NET components.  BlogEngine.NET was designed to allow using these providers however and is fully supported. This screencast is a bit longer than the previous two as I start without the membership and roles services in a database and walk you through creating these, checking permissions, setting up your web.config to use them and adding your initial roles and users in the database. As before, it is available in both an in page flash version and Windows Media Video format. Here is the web.config updates (for those interested):

<membership defaultProvider="SqlMembershipProvider" >
<clear />
<add name="XmlMembershipProvider"
 type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core"
 description="XML membership provider"
<add name="SqlMembershipProvider"
 applicationName = "BlogEngine"/>

<roleManager defaultProvider="SqlRoleProvider" enabled="true"
 cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES">
<clear />
<add name="XmlRoleProvider"
 type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core"
 description="XML role provider"
<add name="SqlRoleProvider"
 applicationName = "BlogEngine"/>
I stress in the screencast, these are the basic entries and lots of options could be added in.  These will get you on the right track however. In case you missed it above, the links to the screencasts are here: Flash version Windows Media Video format

 Using the BlogEngine.NET SQL Server Provider Screencast

-   Jan 04, 2008 -   BlogEngine.NET, Screencasts -   , , ,

My second 1.3 screencast is a walk through of setting up the SQL Server provider from BlogEngine.NET.  It starts where the Installation screencast leaves off and takes you through database setup and updating your web.config.  The SQL Provider setup changed a bit between versions 1.2 and 1.3 making the old screencast incorrect.  I hope to be writing a more detailed post about SQL provider setup in the day ahead. Anyway, this is a very short video but hopefully someone will find it somewhat helpful.  It is available in both an in page Flash version and Windows Media format.

 BlogEngine.NET 1.3 Upgrade Guide

-   Dec 23, 2007 -   BlogEngine.NET -   , ,

As we all know, installing BlogEngine.NET from scratch is a piece of cake.  Upgrading, however, can cause people a bit of concern and it is easy to overlook something.  Here is a guide for your journey to BlogEngine.NET 1.3 from 1.2. 1. Back it up This is the standard first step to doing most anything.  While I don't always do this step myself, I should and you'd be wise to as well. At a minimum, backup your App_Data folder and any custom themes or extensions you might have done.  SQL users should add the sql.config file as well as the database to that. 2. Download BlogEngine.NET 1.3 (website) This is an easy and painless step.  If you are reading this, you likely already have done this step.  If not, get it here.  Unzip this file to a place you can work with it.  Go into properties and remove the Read Only check.  (This step has helped some and has never hurt anyone.) 3. Update the Database If you are an XML user, please take a moment of silence for your SQL lovin' brethren, as they actually have something to do in this step.  Then move on to step #4. Ok, SQL provider people, there are two things you need to take care of to get ready for 1.3. First, you need to download the upgrade script and run it.  This does a bunch of magic including adding a field to a table, adds some entries to your settings table, and some other stuff like indexes, relations, etc. Second, you are going to need to update your web.config file.  Release 1.3 has moved away from using the sql.config as it was not supported in mono.  So you are going to need to move your connection string to the new web.config file.  (Yes, I'm really sorry about that.) Also, don't forget to make the MSSQLProvider the default provider (as XML is the default setting in the new web.config.) 4. Update your web site Now, we are copy the new stuff to your website.  You'll want to copy everything up except the App_Data folder. Once it is copied, you should be able to browse to your blog and see the 1.3 version number at the bottom of the page. 5. Update your Settings Login and go to your settings page.  There are a few new things to look at. Under the Basic Settings area, you'll see a Mobile Theme and Show post navigation links options.  Be sure to select Mobile for your Mobile theme (unless you've already made a new one.) Under the Advanced Settings, Enable Trackbacks and Enable Pingbacks now appear with Send and Receive options.  Turn them on or off as you'd like. Be sure to click Save Settings when you are done. Troubleshooting If you are having trouble getting your web site up after copying the files up, please remove any custom themes and extensions and try again.  (You may need to manually change the selected theme to Standard in your settings.xml file or be_settings table if you remove a theme that you were using. If you still have trouble after that, please have a look on the BlogEngine.NET forums and wiki.  Someone else likely had a similar problem so searching is the best option.  If not however, ask a question. Good luck and enjoy the latest version.