1

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

  • What version are you using? I assume the code above is from two separate endpoints, one self hosted(web?console?) and another NServiceBus Hosted, is this correct? This Error comes from Autofac, did you configure your transport? (i.e. .UseTransport()) – Sean Farmar Oct 18 '13 at 12:10
  • I am using Version 4.0.0.0. This code is from one sigle host that's supposed to hadnle a certain type of message, do some processing and then publish a message. I am not quite sure if I am using the correct configuration. – Prasad Basani Oct 18 '13 at 18:29
  • It is saying .UseTransport() is obsolete and the new TransportConfig doesn't have a setting for ErrorQueue. – Prasad Basani Oct 18 '13 at 19:01

1 Answers1

-2

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

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

Sean Farmar
  • 2,254
  • 13
  • 10