Getting started instructions - for April 25, 2011 release

May 23, 2011 at 3:02 AM

Ran into a number of challenges getting NBlog to work.  Below are the steps I took to resolve them.  If I missed any, feel free to comment.  Also, I can update the list if need be:

  1. Testing - Gallio and MbUnit are missing so you'll need to download and install them.  It seems the easiest solution is to install the bundle at:
  2. Web.config - Change appSettings to match settings.json:
    • Old:
          <add key="NBlog_Site" value="" />
          <add key="NBlog_Site" value="NBlog" />
  3. (Optional) Authentication - if (or in case) you have any problems with logging in, you may want to modify the authentication controller as described in:
  4. Set up SQL (I suspect MongoDB will be similar)
    1. Edit Global.asax.cs:
          i. Find the "RegisterDependencies" method.
          ii. Find the autofac configuration for the SQL database - it looks like:
          iii. NamedParameters - There are 2 you'll need to set, or at least pay attenditon to:
      1) "connectionString".  FYI if you're using a local SqlExpress instance, the line might look like this:
                 new NamedParameter("connectionString", @"Server=.\SqlExpress;Trusted_Connection=True;")
      2) "databaseName"
          BTW, you can alternate between using json as the provider for the blog entries and SQL by changing the builder registration for the EntryService:
    2. Create the SQL database - to match the one you specified in the NamedParameter above.  You'll need to set the security for the database so that NBlog can access it.
    3. Create the "Entry" table - connect to the database and execute the SQL found in SQLRepository.cs:
      CREATE TABLE [dbo].[Entry]
          [Id] int NOT NULL IDENTITY (1, 1) PRIMARY KEY,
      	[Slug] [nvarchar](250) NOT NULL,
      	[Title] [nvarchar](250) NULL,
      	[Author] [nvarchar](250) NULL,
      	[DateCreated] [datetime] NULL,
      	[Markdown] [nvarchar](max) NULL,
      	[IsPublished] [bit] NULL,
      	[IsCodePrettified] [bit] NULL
  5. OpenID - set up an OpenID account on one of the supported providers.  e.g. a gmail account.
  6. I think you'll be able to run NBlog at this point.  So: 
    • Run it!
  7. Now you'll want to add an entry to the settings file to make your login an administrator - so you can create and edit blog entries.
    1. Sign in
    2. Go to home/whoami - e.g. if your running at http://localhost/nblog/ the you want //localhost/nblog/home/whoami
    3. Copy the value that is returned  (for Google, it'll look something like:
    4. Edit settings.json, look for "Admins": and add it there.  It should look something like:
    5. Save settings.json.
    6. Refresh the page and you should see new links like "Admin: New Post" (if you're on the home page) or "Admin: Edit" (if you're looking at a post).


May 25, 2011 at 5:28 PM

Awesome set of instructions.  Been needed for a while, so thanks!  I'm running NBlog on my site at and am wondering if there's still any active development being done on this project.  I love the engine and am willing to contribute additions as well.

May 26, 2011 at 12:36 PM

Yes, great set of instructions.  I'm going to start putting together some decent documentation, this is a fantastic start.  There's ongoing development, aiming for another release in two or three weeks.  All contributions welcome, please branch from and create a pull request.

Jul 8, 2011 at 8:06 PM

Does I set right connection string?

            builder.RegisterType<SqlRepository>().Named<IRepository>("sql").InstancePerLifetimeScope().WithParameters(new[] {
                new NamedParameter("keys", repositoryKeys),
                new NamedParameter(";Database=u231179_behru;uid=u231179;pwd=qwerty;", "Server=.;Trusted_Connection=True;"),
                new NamedParameter("databaseName", "NBlog")


When I cone to site I see only error

Aug 17, 2011 at 5:46 PM

I would just grab the connection string from the web.config file. Here's a simple example:

var conString = ConfigurationManager.ConnectionStrings["NBlog"];
var connectionString =   new System.Data.SqlClient.SqlConnectionStringBuilder(conString.ConnectionString);
builder.RegisterType<SqlRepository>().Named<IRepository>("sql").InstancePerLifetimeScope().WithParameters(new[] {
    new NamedParameter("keys", repositoryKeys),
    new NamedParameter("connectionString", conString.ConnectionString),
    new NamedParameter("databaseName", connectionString.InitialCatalog)

This would make it a lot easier for you to only have to update it in one place (web.config) versus in the global.asax.cs file also.

Hope this helps.