Auto-subscribe failing to send message to publisher

I keep receiving this message on all three of my endpoints that I have configured as console applications.

ERROR AutoSubscribe was unable to subscribe to event ‘MyEvent’: Failed to send message to address: MyQueue.Input@MyMachineName

The inner exception is:

KeyNotFoundException: The given key was not present in the dictionary.

Permissions seem to be appropriate and I’ve set each endpoint up with the following configurations for transport and persistence since I am using MSMQ.

    var transport = endpointConfiguration.UseTransport<MsmqTransport>();
    var persistence = endpointConfiguration.UsePersistence<MsmqPersistence>();


Again this is occurring on all three endpoints, I do also have a section for registering my publishers and all of the message types in the assembly/namespace.

transport.Routing().RegisterPublisher(typeof(MyMessage).Assembly, "MyMessages.Messages", "Publisher.Input");

Am I missing something or could it be something with registering using the assembly/namespace?

Any help is appreciated!


I found my error.

I added this section to add a message label to my messages.

        // Set the msmq message label to the current Correlation Id
            labelGenerator: headers =>
                return headers[Headers.CorrelationId];

This was causing the error. Not sure why, but after looking through my stack trace, I noticed it was erroring on a MsmqMessageDispatcher.GetLabel method. Removing the label generator fixed the issue.