Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7566447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:24:57+00:00 2026-05-30T14:24:57+00:00

After adding logging (using log4net) to my application, it no longer handles subscription messages

  • 0

After adding logging (using log4net) to my application, it no longer handles subscription messages correctly and puts them on to the error queue. Below, some namespace names have been changed to protect the innocent.

app.config

<?xml version="1.0"?>
<configuration>
<configSections>
    <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
    <section name="MsmqSubscriptionStorageConfig" type="NServiceBus.Config.MsmqSubscriptionStorageConfig, NServiceBus.Core" />
    <section name="Logging" type="NServiceBus.Config.Logging, NServiceBus.Core" />
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>

<Logging Threshold="INFO" />

<log4net>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
        <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &lt;%X{auth}&gt; - %m%n"/>
        </layout>
    </appender>
    <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
        <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &lt;%X{auth}&gt; - %m%n"/>
        </layout>
    </appender>
    <appender name="TraceAppender" type="log4net.Appender.TraceAppender">
        <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &lt;%X{auth}&gt; - %m%n"/>
        </layout>
    </appender>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
        <file value="logfile.txt" />
        <appendToFile value="true" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
        </layout>
    </appender>
    <root>
        <level value="INFO"/>
        <appender-ref ref="ConsoleAppender"/>
        <appender-ref ref="FileAppender"/>
    </root>
</log4net>

<MsmqTransportConfig
  InputQueue="BankRequestDispatcherInputQueue_DEV2"
  ErrorQueue="error"
  NumberOfWorkerThreads="1"
  MaxRetries="5"
/>

<UnicastBusConfig ForwardReceivedMessagesTo="auditqueue">
    <MessageEndpointMappings>
        <add Messages="<assembly>.BankRequestBatchClosed,<assembly>" Endpoint="ScheduledBatchAgentInputQueue_DEV2" />
    </MessageEndpointMappings>
</UnicastBusConfig>

<MsmqSubscriptionStorageConfig Queue="BRDispatcher_DEV2_subscriptions" />

<!-- Neccessary for Fluent/NHibernate/SQLLite dlls -->
<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"  sku=".NETFramework,Version=v4.0"/>
</startup>
<appSettings>
    <add key="TempRequestFileLocation" value="c:\temp\"/>
    <add key="KeepRequestFiles" value="true"/>
    <add key="Environment" value="TEST"/>
</appSettings>
</configuration>

I’ve also changed the Endpoint config to this:

namespace myNamespace.BRDispatcher
{
    /// <summary>
    /// Interface tells NServiceBus which roles to setup for this class. 
    /// </summary> 
    public class BRDEndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization
    {
        #region Class References -1-
        /// <summary>
        /// Reference to Logger object.
        /// </summary>
        private static readonly ILog Logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        #endregion
    public void Init()
    {
        NServiceBus.SetLoggingLibrary.Log4Net(log4net.Config.XmlConfigurator.Configure);

        Logger.Info("BankRequestDispatcher - Init()");

        NServiceBus.Configure.With()
            //.Log4Net()
          .DefaultBuilder()
          .XmlSerializer()
          .MsmqSubscriptionStorage()
          .MsmqTransport()
             .IsTransactional(true)
             .PurgeOnStartup(false)
          .UnicastBus()
             .ImpersonateSender(false)
             .LoadMessageHandlers()
          .CreateBus()
          .Start();

        Logger.Info("BankRequestDispatcher - Init() Complete");
    }
}
}

When it fires up, any subscription message received gets dumped onto the error queue and I see this in the log:

2012-02-22 17:02:48,013 [Worker.8] ERROR NServiceBus.Unicast.Transport.Msmq.MsmqTransport [(null)] - Message has failed the maximum number of times allowed, ID=94b95c71-896f-4991-b3ba-9d2068a68c63\81504.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:24:59+00:00Added an answer on May 30, 2026 at 2:24 pm

    I have found one cause of the error/problem. If the message forwarding queue is specified in the app.config (ForwardReceivedMessagesTo) but the queue does not exist on the host machine then you will get the same error.

    app.config

    <UnicastBusConfig ForwardReceivedMessagesTo="auditqueue">
    <MessageEndpointMappings>
        <add Messages="<assembly>.BankRequestBatchClosed,<assembly>" Endpoint="ScheduledBatchAgentInputQueue_DEV2" />
    </MessageEndpointMappings>
    

    The problem was caused as only one process out of the six I’ve got running named the missing queue in the Test environment. Five were set to ‘auditqueue’ and one was ‘auditqueue_test2’ which, sadly was the correct name except it didn’t exist and it does not auto-create the queue in this instance nor make any remark in the DEBUG statements that this is the problem.

    I created a new transactional queue called ‘auditqueue_test2’ and it’s now running. I’m going to add in the logging again and see if it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have been using log4net for logging our asp.net web forms application. Our logging
I am getting this error after adding the libxml2.2.dylib file Linking /Users/Biranchi/Desktop/Funmovies TabBarController/build/Debug-iphonesimulator/funmovies.app/funmovies (1
I'm using aspxgridview and after adding operation by using RowInserting event and I don't
I'm using set_cookie() on a site. After adding some functionality, I'm getting Warning: Cannot
After adding the /TSAWARE linker flag to one of my projects (Visual Studio 6),
After adding the key value pairs in NSMutableDictionary, when i retrive the key/values from
Does anyone know what the esiest way to update the entity model after adding/deleting
I'm having a memory problem related to UIImageView. After adding this view to my
We use Sajax for adding small Ajax code to sites. After running into a
Context: I'm working on master adding a simple feature. After a few minutes I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.