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 '[email protected]@localhost' as it could not be found. ---> NServiceBus.Unicast.Queuing.QueueNotFoundException: Failed to send message to address: [[email protected]@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: [[email protected]@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 '[email protected]@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: