Here’s a new NServiceBus sample application, this time showing the use of NServiceBus distributor. The application is built so that you can just grab the source code, open the solution and run it.

The sample application is built with Visual Studio 2010 and .NET Framework 4.


We’ve covered the distributor’s basics before (“Using NServiceBus Distributor”)and this sample uses the configuration files from that post. The sample is built over the application which we created in “NServiceBus: In-order message processing “.This means that the application has an ASP.NET MVC 2 client.

Project structure

The sample application’s solution contains five projects:

  • Client
  • Distributor
  • Messages
  • Worker
  • Worker2

The projects are configured to start the generic host automatically, so when run, four windows should open: three console windows (one for every generic host) and one browser window with the client. This works if you open the solution by double clicking it. This sets the Visual Studio’s working folder to the solution’s root.


If you have problems running the distributor or the workers, change the “Start external program” from your project’s configuration to point into the correct NServiceBus.Host.exe.

Please let me know if you encounter any other problems.


You can get the source code from GitHub.