Messages not forwarded to error queue when exception is thrown in handler (it works on my machine)
        Posted  
        
            by 
                darthjit
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by darthjit
        
        
        
        Published on 2013-11-08T00:32:08Z
        Indexed on 
            2013/11/08
            21:54 UTC
        
        
        Read the original article
        Hit count: 350
        
c#
|nservicebus
e are using NServicebus 4.0.5 with sql server(sql server 2012) as transport. When the handler throws an exception, NSB does not retry or move the message to the error queue. Successful messages make it to the audit queue but the failed/errored ones don't! . Interestingly, all this works on our local machines(windows 7 ,sql server localdb) but not on windows server 2012 (sql server 2012). Here is the config info on the subscriber:
<add name="NServiceBus/Transport" connectionString="Data Source=xxx;Initial 
Catalog=NServiceBus;Integrated Security=SSPI;Enlist=false;" />
    <add name="NServiceBus/Persistence" connectionString="Data 
Source=xxx;Initial Catalog=NServiceBus;Integrated 
Security=SSPI;Enlist=false;" />
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" /> 
  <UnicastBusConfig ForwardReceivedMessagesTo="audit"> 
    <MessageEndpointMappings> 
      <add Assembly="Services.Section.Messages" Endpoint=
"Services.ACL.Worker" /> 
    </MessageEndpointMappings> 
  </UnicastBusConfig>
And in code it is configured as follows:
public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, 
IWantCustomInitialization
    {
        public void Init()
        {
            IContainer container = ContainerInstanceProvider.
GetContainerInstance();
            Configure
                .Transactions.Enable();
            Configure.With()
                     .AutofacBuilder(container)
                     .UseTransport<SqlServer>()
                     .Log4Net()
                     //.Serialization.Json()
                     .UseNHibernateSubscriptionPersister()
                     .UseNHibernateTimeoutPersister()
                     .MessageForwardingInCaseOfFault()
                     .RijndaelEncryptionService()
                     .DefiningCommandsAs(type => type.Namespace != null &&type
.Namespace.EndsWith("Commands"))
                     .DefiningEventsAs(type => type.Namespace != null &&type
.Namespace.EndsWith("Events"))
                     .UnicastBus();
        }
    }
Any ideas on how to fix this?
here is the log info (there is a lot there, search for error to see the relevant parts)
© Stack Overflow or respective owner