0
votes

We have an ASP.NET MVC application that currently sends commands to a NServiceBus (v3) service.

The service publishes events that we need to subscribe to within the web application so that we can display real time notifications to our users.

The bus is currently initialised as below within the web application:

private static IBus ConfigureBus()
{
    return NServiceBus.Configure.With()
        .DefaultBuilder()
        .XmlSerializer()
        .MsmqTransport()
            .IsTransactional(false)
            .PurgeOnStartup(true)
        .UnicastBus()
            .LoadMessageHandlers()
        .CreateBus()
        .Start(() => Configure.Instance.ForInstallationOn<Windows>().Install());
}

With the following configuration in web.config:

  <!-- NServiceBus -->
  <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
  <UnicastBusConfig ForwardReceivedMessagesTo="audit">
    <MessageEndpointMappings>
      <add Assembly="Foo.DocumentService.Messages" Endpoint="Foo.DocumentService.Host" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

However, the event handler I have created within the web application is not invoked, no queue is created for the web application and I don't see any subscription messages sent to the host.

Am I missing something?

1
What do the logs say?John Simons
Do your events derive from IEvent or follow a convention?Chris Bednarski
This is probably a wild stab but it may have something to do with permissions. Try providing access to msmq for the identity your site runs under and see what happens.Eben Roux

1 Answers

0
votes

After enabling logging I could see that NServiceBus was not actually getting initialised (which is why no queues were created).

The issue turned out to be how I had configured Ninject as the bus was being lazily initialised. A quick change to my bindings and everything worked.