Question

When an exception occurs in the code that's called from the handler, the host tries it for 5 times and then shuts down the service with the following message:

2013-10-17 08:57:12,091 [13] FATAL NServiceBus.Faults.Forwarder.FaultManager [(null)] - Could not forward failed message to error queue. Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'NServiceBus.Transports.ISendMessages' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency. 2013-10-17 08:57:12,139 [13] FATAL NServiceBus [(null)] - Fault manager failed to process the failed message with id e0fc75b2-4eef-4f90-a450-a25901130c9a System.InvalidOperationException: Could not forward failed message to error queue. ---> Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'NServiceBus.Transports.ISendMessages' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.

Here's my config:

<configSections>
    <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
  <UnicastBusConfig ForwardReceivedMessagesTo="audit">
    <MessageEndpointMappings />
  </UnicastBusConfig>

Here's my Bus initialization code:

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, AsA_Publisher, UsingTransport<Msmq>
    {

    }

NServiceBus.SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);
            NServiceBus.Unicast.Config.ConfigUnicastBus busConfig = Configure.With()
                .Log4Net()
                .DefaultBuilder()
                .MsmqSubscriptionStorage()
                .UnicastBus();

            Bus = busConfig.CreateBus().Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());

I am not quite sure why it is not able to try the SLR after failing 5 times and also forwarding it to the error queue after that.

Any help is appreciated!

Thanks Prasad

Was it helpful?

Solution

Take a look here: https://github.com/sfarmar/Samples/tree/master/HalloWorldWithPubSub

I'm hoping this can guide you in the right direction

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top