Over the past several months, I’ve been wanting to start a journal to keep track of all the encounters of my daily programmer life. Until now, I’ve mainly used Microsoft Outlook’s Journal feature. This works fine, but it doesn’t publish it for all the world to see. What if I actually do discover something useful for others to get some good out of it? I could have taken the easy route and just used an existing blog site or facebook I suppose. But, since I’m in learning mode, why not set up my own website, with my own personal blog? What a cool idea, right? So I set off googling and stumbled upon BlogEngine.Net. This link gives you some more choices of what’s currently out there: http://csharp-source.net/open-source/bloggers It’s a customizable open source ASP.Net blog application written C#. Link to BlogEngine.Net .
For the sake of this blog entry, I’ve already got my environment ready to go.
Steps to installation:
- Downloaded the source code from: http://blogengine.codeplex.com/releases/view/39387 (at the time of this posting version 1.6 is current). I downloaded the source because I want to be able to see what’s going on inside.
- Extracted the source to my local Visual Studio projects directory. I’m currently using Visual Studio 2008.
- Opened the solution in VS2008. I immediately added a “Web Deployment Project” by first selecting the BlogEngine.Net project, then selecting “Build” “Add Web Deployment Project…” from the menu. The Web Deployment feature is not native to VS2008, you need to download and install it if you don’t already have it. Search on “Visual Studio 2008 Web Deployment Projects – RTW”
- Rebuild the application. Make sure you choose “Release” from the main menu and not debug (if you’re ready to deploy it). Then select the new deployment project “BlogEngine.NET_deploy”, right click and choose build.
- Using explorer, go into the project directory, then into the BlogEngine.NET_deploy directory, then into the release directory. Visual Studio has created a nice deployment package for you. So now you can copy all the files from here into your web root directory.
- Add the new application into IIS7.
- Update the file permissions to the “App_Data” folder to allow for IIS7 to have write permissions.
- Finished setup!
Issues:
In step 2, I originally saved the solution as a zip file on my desktop. Then I extracted it with explorer to my project folder. After I extracted the solution, and opened it with Visual Studio, and VS gave me a warning message: “The project location is not trusted”. Why would this be? I’ve had this error before, but it was on a file share path to a server. But this project is located on my hard drive. After some googling, I discovered a trick from leedumond.com. I needed to alter the permissions on the zip file first. So right click on the file, then select properties, then in the general tab, click the “Unblock” tab prior to extracting the file.
I had some troubles initially getting IIS7 to display the blog at first. I was getting an error screen. First, to figure out what the problem was, I went into the Web.Config file in the main folder, and changed the customErrors mode=”RemoteOnly” to “Off”. This allows me to see any errors from any browser, and not just on the server. The problem turned out to be file permissions on the App_Data folder. I used the procedure outlined in the installation instructions, and solved the problem straight away.
Additional thoughts:
If you’re wanting to publish the BlogEngine.Net application to a remote server, you can do it directly in VS 2008 with the Build / Publish Web Site option. You can use FTP or you’ll need the front page extensions loaded on the remote web server. See this great article: Using Visual Studio 2008 with IIS 7. Download the FrontPage 2002 Server Extensions for IIS 7.0here.
So, now, my new blogging application works great! But I wanted to take it that last step further. I wanted to hook it up to my SqlServer database. After reading the instructions, it all looked pretty straight forward. Here are the steps involved:
- Open up SSMS (Sql Server Management Studio).
- Create a new database. Let’s use blogDb.
- Create a new user and grant access to the new database. Let’s use blogUsr. I wanted to create a Sql Server user and not have my application log in as a Windows user. Here is the script:
use blogDb;
gocreate login blogUsr with password = ‘blogUsr’, check_policy = off
gocreate user blogUsr for login blogDb;
gogrant alter to blogUsr;
gosp_addrolemember ‘db_datareader’, ‘blogUsr’
gosp_addrolemember ‘db_datawriter’, ‘blogUsr’
go - Renamed Web.Config to Web.Config.Orig in the BlogEngine.Net project folder, and copied SQLServerWeb.Config in the setup\SqlServer\ directory to Web.Config in the BlogEngine.Net folder.
- Edited the connection string in the new Web.Config file to point to the SqlServer database. Here is the connection string used:
<add name=”BlogEngine” connectionString=”Data Source=WebServer\MSSQLWEB;User ID=blogUsr;Password=blogUsrs;persist security info=False;initial catalog=blogDb;” providerName=”System.Data.SqlClient”/>
- Bring up BlogEngine.Net in a browser and reconfigure it. Done!
Final note: I installed a utility called ieSpell which allows me to spell check my posts directly in the browser editor window.
Continuing my quest for knowledge and efficiency, I’ve come across Windows Live Writer. This little program runs quite well with BlogEngine.Net. I also downloaded and installed, Carlos Aguilar Mares’s Colorized Codeplug-in, which I used nicely in the above code section.
Leave a Reply
You must be logged in to post a comment.