NServiceBus MSMQ 发送问题
我在通过 NServiceBus 发送消息时遇到问题。我有一个 ASP.Net MVC Web 应用程序,在 Win7 x64 上开发,我已将 web.config 配置为
<MsmqTransportConfig InputQueue="worker" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="PricingInformation.Messages" Endpoint="worker2" />
</MessageEndpointMappings> </UnicastBusConfig>
在 application_start 中,我连接以下内容:
var bus = NServiceBus.Configure.WithWeb()
.StructureMapBuilder()
.XmlSerializer()
.MsmqTransport()
.IsTransactional(false)
.PurgeOnStartup(false)
.UnicastBus()
.ImpersonateSender(false)
.CreateBus()
.Start();
当我感兴趣的操作发生在应用程序中时,我触发
public override void HandleEvent(SupplierPricingUpdatedEvent updatedEvent)
{
bus.Send(new ModelSupplierDetailsUpdatedMessage() {Id = updatedEvent.Id})
return;
}
ModelSupplierDetailsUpdatedMessage is simple class in PricingInformation .Messages使用接口标记IMessage并用Serialized属性修饰。
MSMQ 队列是设置的,而不是事务性的,并且包括 NETWORK SERVICE 和 IIS_IUSRS 在内的每个人都具有完全控制权(在绝望的故障排除措施中)
log4net 显示以下内容:
DEBUG NServiceBus.Utils.MsmqUtilities 14 - Checking if queue exists: worker.
DEBUG NServiceBus.Utils.MsmqUtilities 14 - 检查队列是否存在:错误。 调试 NServiceBus.Unicast.UnicastBus Worker.15 - 在 NServiceBus.SagaPersisters.NHibernate.NHibernateMessageModule 上调用“HandleBeginMessage” 信息 NServiceBus.Unicast.UnicastBus Worker.15 - 工作线程已初始化。 调试 NServiceBus.Unicast.UnicastBus Worker.15 - 在 NServiceBus.SagaPersisters.NHibernate.NHibernateMessageModule 上调用“HandleEndMessage” 调试 NServiceBus.Unicast.UnicastBus 9 - 发送消息 PricingInformation.Messages.ModelSupplierDetailsUpdatedMessage、PricingInformation.Messages、Version=1.0.0.0、Culture=neutral、PublicKeyToken=null,ID 为 2c642672-1bf1-48d4-a90f- 734e2fdd726d\8267 到目标worker2。
然而,无论我尝试什么、调整什么(已经花了三个小时),消息都不会出现在队列中。我找不到异常,并且我对所有内容都有调试级别日志记录。这可能是一些简单的帮助
I have trouble sending a message via NServiceBus. I have an ASP.Net MVC web app, developing on Win7 x64, I have configured my web.config as
<MsmqTransportConfig InputQueue="worker" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="PricingInformation.Messages" Endpoint="worker2" />
</MessageEndpointMappings> </UnicastBusConfig>
In application_start I wire up the following:
var bus = NServiceBus.Configure.WithWeb()
.StructureMapBuilder()
.XmlSerializer()
.MsmqTransport()
.IsTransactional(false)
.PurgeOnStartup(false)
.UnicastBus()
.ImpersonateSender(false)
.CreateBus()
.Start();
When the action I'm interested happens in the app I fire
public override void HandleEvent(SupplierPricingUpdatedEvent updatedEvent)
{
bus.Send(new ModelSupplierDetailsUpdatedMessage() {Id = updatedEvent.Id})
return;
}
ModelSupplierDetailsUpdatedMessage is simple class in PricingInformation.Messages using interface marker IMessage and decorated with Serializable attribute.
The MSMQ queues are setup, not transactional, and everyone including NETWORK SERVICE and IIS_IUSRS have full control (in deseperate troubleshooting measures)
log4net shows the following:
DEBUG NServiceBus.Utils.MsmqUtilities 14 - Checking if queue exists: worker.
DEBUG NServiceBus.Utils.MsmqUtilities 14 - Checking if queue exists: error.
DEBUG NServiceBus.Unicast.UnicastBus Worker.15 - Calling 'HandleBeginMessage' on NServiceBus.SagaPersisters.NHibernate.NHibernateMessageModule
INFO NServiceBus.Unicast.UnicastBus Worker.15 - worker initialized.
DEBUG NServiceBus.Unicast.UnicastBus Worker.15 - Calling 'HandleEndMessage' on NServiceBus.SagaPersisters.NHibernate.NHibernateMessageModule
DEBUG NServiceBus.Unicast.UnicastBus 9 - Sending message PricingInformation.Messages.ModelSupplierDetailsUpdatedMessage, PricingInformation.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null with ID 2c642672-1bf1-48d4-a90f-734e2fdd726d\8267 to destination worker2.
Yet no matter what I try, and what I tweak (been three hours at it already) the message never appears in the queue. I cant find an exception and i have debug level logging on everything.. Its probably something simple help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是,如果您手动将队列设置为非事务性的,那么它就不起作用。将 NServiceBus“IsTransactional”属性设置为 false 并不意味着您可以使用非事务性队列。
请尝试删除队列并将其重新创建为事务队列,或者,如果您使用的是 v2.0 的测试版,则只需让 NServiceBus 为您创建队列。
The problem is that if you manually set up your queues as non-transactional, then it won't work. Setting the NServiceBus "IsTransactional" property to false doesn't mean you can work with non-transactional queues.
Please try deleting the queues and recreating them as transactional or, if you're using the beta of v2.0, just letting NServiceBus create the queues for you.