In the past, integrating NServiceBus into a web application typically meant adding the fluent configuration block to the Global.asax file and then keeping a static reference to the IBus property, because ASP.NET has not been very friendly to dependency injection.
In ASP.NET MVC 3, Microsoft has changed that by adding some nice abstractions around dependency resolution. With a little effort, this allows us to inject NServiceBus (and its dependency injection container) into the dependency resolution pipeline.
In this example, I will show how to add NServiceBus to an MVC 3 web application so that common NServiceBus types (IBus chief among them) are injected into your controller classes.
Note: Karl Nilsson has written a post extending this one, showing how to inject NServiceBus into an ASP.NET MVC4 Web API solution, which requires just a few minor adjustments.