This blog is part of a series, Checklist for Starting Your Own Blog Business.
Once I finished customizing the BlogEngine.NET 1.3 code and my blogsite's theme, I needed to build and deploy the software. This work included the following steps:
- Save a Backup of the Code to be Deployed
- Prepare the Software for Production
- Deploy the Software to the Production Servers
- Configure Production Settings
Save a Backup of the Code to be Deployed
There are many ways to do backup your project. You can save a copy of all the files to another folder. You can make a branch or pin in source control. The point is that you save a copy of your development configuration and also save a snapshot of what was deployed to production. In case something goes wrong with a future deployment, you want to be able to "roll back" to the working backup you saved!
Prepare the Software for Production
I removed the files that wouldn't be used in production. Since I only needed to deploy files from the BlogEngine.Web project, I only focused on cleaning up the files from that solution. I only put test posts on my development server. If I was writing "real" posts for publication, then I would have saved more files. The removed files included:
- App_Data/nonzero.xml (file existed since I tested this theme)
- App_Data/files (contents of this folder)
- App_Data/log (contents of this folder)
- App_Data/monstercache (contents of this folder)
- App_Data/pages (contents of this folder)
- App_Data/posts (contents of this folder)
- bin/Blogengine.Core.pdb
- bin/BlogEngine.Core.XML
- setup (entire folder and all contents)
- Themes (remove all themes that will not be used in production - I kept my theme, Standard, and a couple extras)
Update the robots.txt file.
For a shared hosting environment, like I started with at CrystalTech, you'll probably need to modify your web.config by commenting out or removing the trust setting. Mads, BlogEngine founder, explained the reason for the trust setting in this forum thread. In a BlogEngine forum, user Sachinjo further explained that the machineKey setting might need to be changed.
<!--
HACK: SN: 3-29-08: CrystalTech required this to be turned off:
<trust level="High"/>-->
If your host is using IIS7, you will need to also change the web.config to support Integrated AppPool. See this BlogEngine.NET discussion for more information on how to migrate the config file.
Several clues told me the site was running on IIS7: The site worked, but CSS was not applied. I got 404 error pages for files that I knew existed, especially .AXD files. It appeared that there is a bug with the httpHandler or that the hosting company had set up IIS with "Verify that file exists" set to true (which would give 404 errors because it would override the ASP.NET httpHandler). CrystalTech's support staff told me that the problem was not the "Verify that file exists" setting. (This is because the Verify setting was in IIS6 and not in IIS7.)
If you're new to IIS7, consider reading these pages to learn more about this new version:
Since I made modifications to both BlogEngine.NET projects, I needed to build them both. I opened the Solution's Configuration to Release and did a Build Solution. Before deploying the software, make sure that the Core project did not add PDB or XML files to the Web project's bin directory.
Deploy the Software to the Production Servers
Setup the web server
FTP the files to the web server. If your blog is the default application for your website, simply FTP the files from the BlogEngine.Web folder to the root folder of your website.
Configure IIS. Make sure that that "default.aspx" as the first default page. Also set IIS to redirect 404 errors to "error404.aspx." This will make sure that visitors will see the custom 404 page for all 404 (missing file) errors, not just those handled by ASP.NET. Here is a screenshot of the IIS configuration from CrystalTech:
You'll probably have to give the ASPNET user write and delete permissions to the App_Data folder. Here is a screenshot of the CrystalTech file permissions screen:
Setup the database server
If you are using SQL Server, there are excellent screencasts that walk you through installing the BlogEngine.NET tables and also the Membership & Roles tables.
When you first create the database, make sure that you create users for both maintaining the database (admin/DBO) and for BlogEngine.NET (ASPNET/datareader+datawriter). To create a database with CrystalTech, use the "MSSQL Admin" menu in the Control Center, then click the "add" button.
Setup your email
Make sure to create an email account with your host and enter those settings into BlogEngine.NET.
Configure Production Settings
Setup Windows Live Writer to use the production/live web server
Using WLW with a "live" server is almost the same as with the Visual Studio development server. The biggest gotcha that I encountered was that the WLW proxy settings for posting to the development server prevented it from connecting to the live server.
Configuring BlogEngine.NET
The admin settings screen asks for your longitude and latitude. Stephen Morse wrote an online app that converts an address to latitude and longitude.
Test the Website
It's probably best to test the functionality and style on as many different browsers, operating systems, and versions as you can. Virtual machines are great tools for helping with this. You can focus your testing to target certain browsers/operating systems based on w3schools' Browser Statistics or Wikipedia's Usage share of web browsers. At any rate, the Netscape web browser is Officially Dead.
Conclusion
From the initial choice to write blogs and to use a hosted solution (BlogEngine.NET) on my own domain (at CrystalTech.com), through customizing and theming the blog server software, choosing blog writing tools, to finally deploying it to production... it has been some work (but not too much work). Now it's all done and I'm ready to start writing blogs. A few months into the future, after I get more into the routine of writing regularly, I'll write the last two blogs in this series about writing blog posts and optimizing the blogging experience. I hope this information has been useful. Let me know about your experiences!