For those of you who don't know, BlogEngine.NET is a great, free and open-source blogging platform for .NET developers and less-technical people alike.

Apart from the fact that BlogEngine.NET is highly customisable, extensible and has many other neat features such as syndication, what attracted me to it was that it uses ASP.NET and XML as the default data store. This last point is fairly important as most hosting companies will charge you extra for setting up databases even for small web sites. By using XML you can keep the overall cost of maintaining a personal web site to a minimum.

Now that I have completed the installation process, I thought I'll briefly outline the steps I took to be up and running with BlogEngine.NET. Note that it is relatively easy to setup but if you really don't want to get your hands 'dirty' go to WordPress or Posterous; you will be blogging for free literally within minutes. For others, follow on...

Step 0: Backup, Backup, Backup

Before you do anything with BlogEngine.NET, you should first ensure that you have a quick and easy way to backup your blog. As you build up your site and make significant infrastructure or cosmetic changes, chances are that at some point you will want to restore it to a previously known working state. So to be safe either put your files under source control - you can either use Git or Subversion for that - or simply use a batch file like the one shown below. Just replace "<BLOG_ENIGNE_FOLDER>" and "<BACKUP_FOLDER>" in the script and it will copy your BlogEngine folder into a backup folder appended with the current date and time.

echo on  
for /f "tokens=1" %%u in ('echo %time%') do set t=%%u  
if "%t:~1,1%"==":" set t=0%t%  
set now=%date:~-4,4%%date:~-7,2%%date:~0,2%T%t:~0,2%%t:~3,2%%t:~6,2%  
C:  
xcopy /e "<BLOG_ENGINE_FOLDER>\*.*" "<BACKUP_FOLDER>\%now%\" 
echo Done!  
pause

Step 1: Basic installation

To get an idea of what the installation process involves, I recommend you watch this screencast before you start. Assuming you already have chosen a hosting company and registered a domain name, the first obvious step is to download the latest version and follow the installation instructions. No need for me to rehash here what's already covered in the documentation as it is pretty comprehensive and easy to follow. If you went along with these instructions step-by-step, you should have effectively an up and running blog on your local machine.

Step 2: Check your Web.Config settings

In the root of your web application, you should have a file called Web.Config as shown below.

 

BlogEngine.NET files  

Unless you need to troubleshoot some issues with the site, you should not run in debug mode (Debug Mode in ASP.NET Applications) as this will affect performance. Instead set the the debug attribute to "false".

<system.web>
	<compilation debug="false">
	   ...
	</compilation>
	   ...
</system.web>

The other attribute you will need to check in the Web.Config file is the customErrors element and its mode attribute which should be set to RemoteOnly. This ensures that your visitors get the BlogEngine.NET user-friendly custom error message if there is a problem with your site and also prevents potentially sensitive information from being displayed. For more on this refer to the MSDN documentation on "customErrors Element".

<system.web>
      ...
	<customErrors mode="RemoteOnly" defaultRedirect="~/error404.aspx">
		<error statusCode="404" redirect="~/error404.aspx"/>
	</customErrors>
	  ...
</system.web>

Although these attributes are set as above by default on version 1.5 of BlogEngine.NET, it is worth checking that this is the case before you release your blog.

Step 3: Choose a data storage type

BlogEngine.NET stores data as XML by default but you are not restricted to XML. You can switch to other blog providers such as Microsoft SQL Server, MySql, SQLite or VistaDB. As I wanted to be able to save all my data (posts, settings, etc.) into a single file that I could copy back and forth between multiple machines and my FTP site, and I did not want to pay extra for using either SQL Server or MySql, I decided to try out SQLite. SQLite is a free and popular self-contained database engine. Setting it up for BlogEngine.NET only requires two files. Instructions can be found in the "BlogEngine.Web\setup\SQLite" folder. As soon as I deployed my site, which was running fine with SQLite on my local machine, I was baffled to see that it did not work in my shared hosting environment. I kept on getting security exceptions. As it happens most shared hosting plans (including mine) will only let you run your application with medium trust level. However because SQLite calls native code (P/Invoke), your ASP.NET application needs to run in a full trust environment if you want to use it. At the end I had to turn to VistaDB instead. Like SQLite, VistaDB is a file based embedded database engine but the main difference is that it is fully managed. You can therefore run your site with partial trust, which seems to work for my hosting environment. To avoid a lot of frustration either stick with XML or make sure you have considered the other data storage options carefully.

Step 4: Theme and customize your site

OK. If you’ve gone this far in the installation process, the fun starts here. This is where you can make your site your own. Once you’re logged in, head straight to the admin control panel and review the options. There you can modify settings such as your blog title, your contact information, enable comments, manage users, etc. Among other things you will be able to change the theme, that is the look and feel, of your blog. BlogEngine.NET comes with a few pre-loaded themes but you are not limited to them. Check out the other themes available or if you'd like to showcase your Designer skills, you can create your own.

Step 5: Install Extensions and Widgets

You can easily add functionality to your site by installing extensions. In most cases this simply consists of dropping a few files in the "\App_Code\Extensions" folder and configuring the newly installed extension using the BlogEngine admin control panel. I suggest you add Justin Etheredge's anti-spam extension first. As soon as I published my first post, I started receiving quite a few spam in the comments and this extension prevents this from happening. It certainly seems to work for me so far.

For a good example of how widgets work in BlogEngine.NET, have a look at the TwitterFeed-Widget on CodePlex.

Step 6: Uploading your site

You can now upload your site to your hosting environment. The easiest way to do this is to use an FTP client. I find FileZilla very handy and reliable to transfer my blog and manage all the BlogEngine.NET files remotely. Did I mentioned that it is also free?

FileZilla FTP Client  

Step 7: Setup Google Analytics (optional)

Once your blog is out there, you might want to monitor your web site traffic. That's where Google Analytics (GA) comes in. GA is a free service that generates detailed reports, graphs and loads of statistics about your visitors. To set this up all you need is a Google email account and register your site on GA. After you've logged in you will find the tracking code (how to find Google Analytics tracking code) which you can then paste in the BlogEngine.NET tracking script pane under the Settings tab in the admin control panel.

 Tracking script pane

Step 8: Download and install Live Writer

BlogEngine.NET includes an online text editor which is relatively useful for making small changes to your blog entries but is frankly not up to the task for writing full-blown blog posts. Instead use the brilliant Windows Live Writer. Not only has it got a lot of formatting options but more importantly it lets you edit your blog posts offline. Follow this short and excellent guide to install it and integrate it with BlogEngine.NET.

Step 9: Start blogging

That is it. But this was the easy part! What you have to do now is think of something to say...

Final Thoughts

Looking back at the above it does seem like there was quite a bit involved in setting up BlogEngine.NET. However this was a good learning experience and fortunately each step was well documented - I've tried to provide all the relevant links that helped me during the installation process. BlogEngine.NET (and the other free tools) make it affordable to create, manage and maintain a personal blog in relatively little time. But more than anything else what I really like about BlogEngine.NET is that it puts you in full control of your site content, look and feel. If you're a .NET Developer looking for a simple and extensible blogging platform, look no further!

Finally a big thanks to all the team at BlogEngine.NET for giving me the satisfaction of having my own site.

Happy Blogging!