質問

I am having issues after migrating to NService 4 (4.0.4). When a message handling fails, it looks like whole NServiceBus is stopping and not doing any work (messages from MSMQ are not consumed any more). After looking into logs, I found the following errors:

NServiceBus.log:

2013-10-02 17:49:31.5786 | FATAL | 110 | Fault manager failed to process the failed message with id aa32dce1-f408-4f6d-b448-a24b0118ec27 System.InvalidOperationException: Could not forward failed message to error queue 'administration.worker@localhost.Retries@localhost' as it could not be found. ---> NServiceBus.Unicast.Queuing.QueueNotFoundException: Failed to send message to address: [administration.worker@localhost.Retries@localhost] ---> System.Messaging.MessageQueueException: The queue does not exist or you do not have sufficient permissions to perform the operation. at System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle() at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, ITransaction transaction) at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, IntPtr transaction) at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 60 --- End of inner exception stack trace --- at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 76 at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, Boolean serializationException) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Faults\Forwarder\FaultManager.cs:line 48 --- End of inner exception stack trace --- at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, Boolean serializationException) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Faults\Forwarder\FaultManager.cs:line 78 at NServiceBus.Unicast.Transport.FirstLevelRetries.TryInvokeFaultManager(TransportMessage message, Exception exception) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Unicast\Transport\FirstLevelRetries.cs:line 71InnerExceptionNServiceBus.Unicast.Queuing.QueueNotFoundException: Failed to send message to address: [administration.worker@localhost.Retries@localhost] ---> System.Messaging.MessageQueueException: The queue does not exist or you do not have sufficient permissions to perform the operation. at System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle() at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, ITransaction transaction) at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, IntPtr transaction) at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 60 --- End of inner exception stack trace --- at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 76 at NServiceBus.Faults.Forwarder.FaultManager.SendFailureMessage(TransportMessage message, Exception e, Boolean serializationException) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Faults\Forwarder\FaultManager.cs:line 48InnerExceptionSystem.Messaging.MessageQueueException (0x80004005): The queue does not exist or you do not have sufficient permissions to perform the operation. at System.Messaging.MessageQueue.MQCacheableInfo.get_WriteHandle() at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, ITransaction transaction) at System.Messaging.MessageQueue.StaleSafeSendMessage(MQPROPS properties, IntPtr transaction) at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 60

MsmqDequeueStrategy.log has lots of:

2013-10-02 17:49:32.5579 | ERROR | 57 | Error processing message. System.ObjectDisposedException: The semaphore has been disposed. at System.Threading.SemaphoreSlim.Release(Int32 releaseCount) at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.Action() in c:\BuildAgent\work\d4de8921a0aabf04\src\NServiceBus.Core\Transports\Msmq\MsmqDequeueStrategy.cs:line 227 at System.Threading.Tasks.Task.Execute()

FaultManager.log:

2013-10-02 17:49:31.5746 | FATAL | 110 | Could not forward failed message to error queue 'administration.worker@localhost.Retries@localhost' as it could not be found.

I init NSB as follows:

Configure.Serialization.Xml();
Configure.Features.Enable<TimeoutManager>();
Configure.Features.Enable<Sagas>();

var conf = Configure.With(assemblies)
.CustomConfigurationSource(new BusConfigSource(assemblies))
.DefineEndpointName(ConfigurationManager.AppSettings["InputQueue"])
.CastleWindsorBuilder(container)
.MessageForwardingInCaseOfFault()
.UseInMemoryTimeoutPersister()
.UseTransport<Msmq>()
.PurgeOnStartup(false)
.FileShareDataBus(WebConfigurationManager.AppSettings["NServiceBusFileShare"])
.UnicastBus()
.LoadMessageHandlers()
.MsmqSubscriptionStorage()
.CreateBus()
    .Start(() => Configure.Instance.ForInstallationOn<Windows>().Install());

EDIT: more info. I host NSB in IIS. I Publish, Send and handle messages in it.

Web.config looks like this: Web.config

役に立ちましたか?

解決

The problem is in your Init code...

.DefineEndpointName(ConfigurationManager.AppSettings["InputQueue"])

I don't see that in the screenshot of your Web.config you provided, but based on the error, I'm guessing you have that defined as "administration.worker@localhost". This should be only "administration".

Endpoint name and input queue are not the same thing. Starting from your endpoint name, NServiceBus infers the names of all the queues from there. So input queue is {EndpointName}@localhost. If you're running a master node with an attached worker, the worker's input queue is {EndpointName}.Worker@localhost. The Timeout queue is {EndpointName}.Timeouts@localhost, etc.

Of course you don't usually have to define the endpoint name in an NServiceBus.Host endpoint, but it looks like you are self-hosting in a web application.

Here's more information on the NServiceBus Input Queue / Endpoint Name from the docs.

他のヒント

This is a funny looking address: administration.worker@localhost.Retries@localhost

you may need to add in your config file:

<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />

and set

<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>

Take a look at the Error handling sample (if you installed NServiceBus it will be in %ProgramFiles%\Particular Software\NServiceBus\v4.0\NServiceBus\Samples\ErrorHandling)

or in Github https://github.com/Particular/NServiceBus/tree/develop/Samples/ErrorHandling

Hope this helps

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top