NServiceBus - Server is throwing empty message war

2019-09-06 19:40发布

2013-03-28 10:18:32,374 [Worker.5] 
WARN  NServiceBus.Unicast.UnicastBus [(null)] <(null)> - 
Received an empty message - ignoring.

I have a client that bus.send("server", command) going from an mvc4 website to a message processor. The message processor was setup to be default without any custom initialization.

This is my configuration on the website side in the global.asax

        Configure.With()
            .StructureMapBuilder(container)
            .JsonSerializer()
            .Log4Net()
            .MsmqTransport()
                .IsTransactional(false)
                .PurgeOnStartup(true)
            .UnicastBus()
                .ImpersonateSender(false)
            .CreateBus()
            .Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());         

I reviewed NServicebus publishing event - recieves empty message, but that didn't help, I don't have read only properties.

2条回答
ら.Afraid
2楼-- · 2019-09-06 20:10

The problem is similar to the linked question in the OP. I found that the serialization methods need to match between the sender and the server. I had to add custom initialization on the server side and add the defaultbuilder as well as the json serializer to match the web side in order for messages to work right.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-09-06 20:14

One other thing which I found was, I was using IWantCustomInitialization with below configuration:

Configure.With(typeof(TransactionDetailsHandler).Assembly) // this is problematic one
                .CastleWindsorBuilder(container)
                .DefaultBuilder();

I didn't specify assembly type of my message in Configure. With adding that resolved the problem.

查看更多
登录 后发表回答