msmq - NServiceBus - 消息并不总是传递并导致异常无法登记事务

标签 msmq nservicebus nservicebus3

我们在生产中使用 NServiceBus,在我们的日志文件中,我们看到以下错误:

ERROR Our.Namespace.SomeMessageHandler [(null)] <(null)> - MethodName  --> end with exception: NServiceBus.Unicast.Queuing.FailedToSendMessageException: Failed to send message to address: our.namespace.worker@somemachinename ---> System.Messaging.MessageQueueException: Cannot enlist the transaction.
    at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
    at NServiceBus.Unicast.Queuing.Msmq.MsmqMessageSender.NServiceBus.Unicast.Queuing.ISendMessages.Send(TransportMessage message, Address address)
    --- End of inner exception stack trace ---
    at NServiceBus.Unicast.Queuing.Msmq.MsmqMessageSender.ThrowFailedToSendException(Address address, Exception ex)
    at NServiceBus.Unicast.Queuing.Msmq.MsmqMessageSender.NServiceBus.Unicast.Queuing.ISendMessages.Send(TransportMessage message, Address address)
    at NServiceBus.Unicast.UnicastBus.SendMessage(List`1 addresses, String correlationId, MessageIntentEnum messageIntent, Object[] messages)
    at NServiceBus.Unicast.UnicastBus.SendMessage(Address address, String correlationId, MessageIntentEnum messageIntent, Object[] messages)
    at NServiceBus.Unicast.UnicastBus.NServiceBus.IBus.Send(Address address, Object[] messages)
    at Our.Namespace.SomeMessageHandler.MethodName(EventLogVO eventLog, IApplicationContext applContext, CreateEventLogHistory message)

目标机器上的队列存在(双重检查)。这里的奇怪之处在于,对于发送到该队列的每条消息,它不会一直发生,而是偶尔发生(这意味着有消息到达该队列)。

搜索了一下,没有找到类似的案例。

我在这里缺少什么?

最佳答案

我们最近遇到了这个错误并将其追踪为以下之一:

  • 数据库性能。我们调整了一个长时间运行的查询,但问题仍然存在。
  • 交易范围大。您可能正在做一些会导致涉及太多资源管理器的事情。
  • MSMQ 资源。最终,我们的磁盘速度不够快,无法执行我们使用 MSMQ 执行的操作所需的 IO。

  • 我会尝试追踪真正的来源(希望你能从上面得到一些想法)。但是,如果所有其他方法都失败了,请首先打开 System.Transactions 日志记录以查看它是否真的超时。如果是,则使用 this section在 app.config 中

    关于msmq - NServiceBus - 消息并不总是传递并导致异常无法登记事务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26083367/

    相关文章:

    windows-services - Msmq 和 WCF 服务

    c# - 更改MsmqIntegrationBinding的消息编码

    MSMQ 无法删除或清除队列

    azure - 我可以在 Windows Azure 上使用 NServiceBus 2.5 吗?

    NServiceBus 与 Windows ServiceBus

    c# - NServiceBus WCF 服务出现错误 System.InvalidOperationException : Reply is neither supported for Commands nor Events

    .net - CaSTLe Windsor 子容器的快照

    nservicebus - 类型...未在序列化器中注册(非网络应用程序)

    c# - 当有大量消息排队时,从 MSMQ 读取速度变慢

    nservicebus - 挂起和修改 NServiceBus saga 超时