Understanding NServiceBus Subscription Storage and Profiles

Official NserviceBus Documentation

The NServiceBus Host
Profiles for the Generic

Our Deployment Details

Version: NServiceBus v2.0 RTM
OS: Windows 2003 Server
App Type: Windows Service
Host: NServiceBus.Host.exe
Subscription Storage: MSMQ

Our Goal

We have just created a new publisher service and it has taken a bit of time to understand exactly how to deploy it so that subscriptions were persisted after the service is restarted.

Out of the box NServiceBus has three options for storing subscription data, Memory, MSMQ or Database.

To use MSMQ you must either create your own custom profile that configures subscriptions to be stored in MSMQ or you must select Integration from  the default profiles.

Regardless of the choice you make you must specify the profile you wish to use when you install the windows service, here is how you do that:

Basic Integration Example:
NServiceBus.Host.exe /install NServiceBus.Integration

Advanced Production Example:

NServiceBus.Host.exe /install NServiceBus.Production /serviceName:MyService /displayName:MyDisplayName/description:MyDescription /username:DOMAINusername /password:MyPassword

To check the service has been setup correctly you can go and look in the properties of the service and check the text at the end of the “Path to executable” field. The example in the screenshot below shows the service is configured to use the Lite profile.

We had one more gotcha our implementation was copy/pasted from one of 
our existing v1.9 services so we had to remove the .MsmqSubscriptionStorage()
option from our config. Now our endpoint config looks like this

public void Init()


The Default Profile’s Subscription Storage

Note: – If you select Production profile you may need to enable some settings inside MSDTC (in Component Services) if your database is on another server.
         – If you are installing on to a machine that has UAC enabled you must run the install from a cmd prompt with elevated priviledges (Run As Administrator)

How to install Subtext Blog Engine

I am interested in the Microsoft MVC framework so with a view to
understanding it properly I decided to pick an open source project that
uses it to help me understand what a real implementation looks like. I
heard Phil Haack talking on the Herding Code podcast about subtext and
it sounded like it is using some interesting technologies, MVC, Lucene
& URL routing^.

Installation on Windows 7 for Development

My Development Platform
– Windows 7 64bit
– Visual Studio 2008 Professional
– Sql Server 2008 (10.0.2531) – 64bit Enterprise
– SVN Revision Number: 4007

Here are the steps I had to complete to begin debugging subtext.
1) Check out the source code – follow this link: http://code.google.com/p/subtext/source/checkout
    or if you have an SVN command line client you can try the command below but it may become out of date.
    svn checkout https://subtext.googlecode.com/svn/trunk/ subtext-read-only
    TIP: When I attempted to checkout the code on my laptop with a 3g dongle I kept getting the error:
         svn: Server sent unexpected return value (400 Bad request) in response to OPTIONS request for ‘http://subtext.googlecode.com/svn/trunk’
         Change the URL to HTTPS://… resolved the issue, I think the cause was a silent proxy.
2) Setting up the database.
    If you have Sql Server installed on your dev machine I think that the idea is that the database will install the first time you run the solution.
    On my machine I had to manually attach the database myself.
        – Open up Sql Server Management Studio and select ‘Attach Database’.
        – Navigate to the sub folder <SVN Checkout Folder>srcSubtext.WebApp_Data
        – If a Log file appears with a message not found delete it then hit ok.
        – Then I updated the connection string to “Data Source=LOCALHOST;Initial Catalog=Subtext2.5;Integrated Security=SSPI;”, this can be found in the          Subtext.web web.config
3) At this point if all is well you should be able to run the soltion and get the “Installation Wizard” page:
    Step 2: Configure the Admin Account (I just followed the instructions and completed the form)
    Step 3: Create A Blog (I just clicked the button)

Some useful reading
http://code.google.com/p/subtext/wiki/DeveloperGuide – Some basic info on getting started with development
http://subtextproject.com/Features-and-Requirements.ashx – Details of features and resources.
svn checkout https://subtext.googlecode.com/svn/trunk/ subtext-read-only

Installation on specific Hosting Sites


Go Daddy