2
votes

I have two simple console applications to integrate nservicebus. One is a publisher, the other a subscriber. The subscriber in the case also receives other messages via Send() from yet another web application. When I run them locally in my dev environment, there are no problems, everything works as expected. I can send message from the web application and receive them on my "subscriber" as well as receive the published message on my subscriber.

However, when deploying to Server 2008 R2, the subscriber sends an initial message to publisher, StatusQueue, with this content:

<?xml version="1.0"?>
<Messages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/NServiceBus.Unicast.Transport">
    <CompletionMessage>
        <ErrorCode>0</ErrorCode>
    </CompletionMessage>
</Messages>

I think this is just the initial "I wanna subscribe to messages you publish of type Messages.*". This message just sits in the queue and is never picked up by the publisher.

The publisher's config:

<MsmqSubscriptionStorageConfig 
    Queue="StatusQueueSubscriptions" />

    <MsmqTransportConfig
        InputQueue="StatusQueue"
        ErrorQueue="StatusError"
        NumberOfWorkerThreads="1"
        MaxRetries="5"/>

The subscriber's config:

<MsmqTransportConfig
    InputQueue="AppsInputQueue"
    ErrorQueue="AppsError"
    NumberOfWorkerThreads="1"
    MaxRetries="5"/>

  <UnicastBusConfig>
    <MessageEndpointMappings>
      <add Messages="Messages" Endpoint="StatusQueue"/>
    </MessageEndpointMappings>
  </UnicastBusConfig>
1

1 Answers

1
votes

The likely reason your subscription is being ignored is that the incoming message to the publisher does not match the type defined in your subscription.

So when the publisher receives the message, it will evaluate it against the subscriptions held in it, and will find no match, so no message will be sent to your subscriber.

This can be because the message type in NServiceBus is defined not just by assembly/type name, but by assembly version and public key token.

Check the versions/PK tokens of the messages assemblies held by the publisher and subscriber and ensure they match exectly.

UPDATE

OK it sounds like The permissions on your input queue are in some way preventing your publisher service account to read messages. Try giving full control to the service account.

Also, have you checked the default logging location for errors in the log? (C:\Users(username)\AppData\Local\Temp)