I've been doing quite a bit of work lately on my site www.lunchsummit.com and decided I wanted a place to write about what I have been working on. For now, this is that place. I thought a Blog would fit the bill and a quick Google search for open source .NET blogs revealed BlogEngine.NET. This post is a write-up of the challenges I encountered getting this configured on my shared deluxe hosting account with GoDaddy.
Environment
First of all, my environment:
BlogEngine was simple enough to get up and running on my server. I simply followed the installation instructions for a fresh installation and used the web distribution (non-source). Since my hosting environment uses IIS7, which runs in integrated pipeline mode, one of the first things I had to do was switch it to Classic mode which is a requirement of BlogEngine. The basic installation uses XML files for a database, but I wanted to use MySQL which posed some hosting infrastructure challenges. BlogEngine includes sample web.config files and SQL scripts for different databases, including MySQL, so I started there. You can find these files in the setup folder, relative to the root:
- \setup\MySQL\MySQLSetup1.4.5.0.sql
- \setup\MySQL\MySQLWeb.Config
MySQL
Using the GoDaddy admin tools I created a MySQL database for BlogEngine to use. I then overwrote the web.config with the provided MySQLWeb.Config file, and updated the connectionString information. Next, I ran the MySQLSetup1.4.5.0.sql script, but ran into script errors. The script errors were related to case sensitivity issues with the table names that prevented the script from running. I then spent some time trying to figure out why MySQL was configured to enforce case sensitive file names and learned that there are some configuration changes that can be made to change this. Using the web admin tool for MySQL I was able to verify that "lower case file system" was set to "OFF" and "lower case table names" was set to "0." Unfortunately I have no way to change these values, so I spent some time modifying the sql script so that the table names were a consistent camel case (download: MySQLSetup1.4.5.0.sql (20.05 kb)).
The sample web.config that is provided with BlogEngine for MySQL is configured for MySQL 5.1, but my hosting account runs MySQL 5.0.x. I downloaded the MySQL 5 .NET Connector and copied to the Bin folder. The next step was to update the web.config assembly information to use the 5.0 connector. I came across web postings from people who were unable to run the MySQL connector in the GoDaddy hosting environment without recompiling to allow partially trusted callers. The MySQL 5 Connector distribution appears to already be configured to allow partially trusted callers. The binary distribution I downloaded worked simply by copying to the Bin folder, so there was no need to download and modify the source to allow partially trusted callers.
Here are the original web.config snippets that required updates:
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,
Version=5.1.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<assemblies>
<add assembly="MySql.Data, Version=5.1.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</assemblies>
If you are unsure of the version of the MySql.Data.dll you can find the version in the file properties from windows explorer. Use the Strong Name Tool to determine the value of PublicKeyToken for the dll.
I updated the above code to the following for my environment:
<system.data>
<DbProviderFactories>
<clear />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,
Version=5.0.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<assemblies>
<add assembly="MySql.Data, Version=5.0.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</assemblies>
Summary
So, in summary the additional steps I had to take to install BlogEngine.NET at GoDaddy with MySQL 5 were:
- Configure IIS7 to use classic pipeline mode.
- Modify the included MySQL script (download: MySQLSetup1.4.5.0.sql (20.05 kb))
- Update the web.config to use MySQL 5 (instead of 5.1)
I hope this post helps others trying to install BlogEngine in similar environments.