Reputation: 31084
After changing the Subscriber2 project in the PubSub sample, I am getting this error when a message is received by this subscriber:
ERROR NServiceBus.Unicast.Transport.Msmq.MsmqTransport [(null)] <(null)> - Could not extract message data. System.TypeLoadException: Could not handle type 'MyMessages.EventMessage'.
I changed the EndpointConfig.cs file to this:
using NServiceBus;
namespace Subscriber2
{
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
{
public void Init()
{
Configure.With(new[] { typeof(EventMessageHandler), typeof(NServiceBus.Unicast.Transport.CompletionMessage) })
.DefaultBuilder()
.XmlSerializer()
.UnicastBus()
.DoNotAutoSubscribe();
}
}
}
Does anyone know why this doesn't work?
Upvotes: 1
Views: 2407
Reputation: 6050
You did not specify your message type in the list. If you use this overload of With() you will have to supply all types. I would recommend pointing to a specific assembly instead and letting NSB scan it for the correct types. Alternatively you could do nothing and let it scan the bin directory.
Upvotes: 2