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

  • SEARCH
  • Home
  • 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 3220960
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:49:16+00:00 2026-05-17T15:49:16+00:00

I’m just starting out with NServiceBus and have updated the PubSub sample to work

  • 0

I’m just starting out with NServiceBus and have updated the PubSub sample to work with .NET 4.0 Framework. That’s working perfectly ok. This runs one publisher and two subscribers within the “NServiceBus.Host.exe” environment – so it is that which takes responsibility for setting up an instance of the Bus and doing any relevant subscriptions. That’s all working fine (as you’d expect) but I’m now trying to move the publisher out of being run within “NServiceBus.Host.exe” into it’s own console application (eventually I would like to publish messages from a website so this seems a good small step in that direction).

If I start the 3 projects (my console app, Sub1 and Sub2) it creates 5 msmq on my local machine, but instead of the endpoint.config…subscriptions Q, it creates a generic “nservicebus_subscriptions” Q. If I enable journals, I see that the MyPublisherInputQueue has three (processed) completion messages with an errorcode 0, whilst the subscriber1inputqueue and subscriber2inputqueue each have one. This all seems good, but if I then publish messages, the publisher doesn’t appear to throw any errors, but no messages make it as far as the subscribers (they just sit waiting for a message). Also no messages appear in either the new message or journal for any of the MQs.

I’m obviously missing some step(s) – Is the console application not opening itself up for subscriptions? If so, what steps are needed to do that? What steps am I missing that run when you host the publisher in the nservicebus.host.exe?

To create the console application I’ve done the following:

  1. Within the pubsub solution, created a console application.
  2. Added references in the console application to mymessages, nservicebus.dll and nservicebus.core.dll
  3. From the existing pub code and example on the NServiceBus website, added following code to “Main()”

Code:

IBus Bus = Configure.With()
                    .Log4Net()
                    .DefaultBuilder()
                    .MsmqSubscriptionStorage()
                    .XmlSerializer()
                    .MsmqTransport()
                    .UnicastBus()
                        .LoadMessageHandlers()
                    .CreateBus()
                    .Start();

bool publishIEvent = true;
do
{
    Console.ReadLine();
    var eventMessage = publishIEvent ? Bus.CreateInstance<IEvent>() : new EventMessage();

    eventMessage.EventId = Guid.NewGuid();
    eventMessage.Time = DateTime.Now.Second > 30 ? (DateTime?)DateTime.Now : null;
    eventMessage.Duration = TimeSpan.FromSeconds(99999D);

    Bus.Send(eventMessage);

    Console.WriteLine("Published event with Id {0}.", eventMessage.EventId);

} while (true);
  1. Created an app.config for the new console application using the contents of the existing “publisher” app.config.

  2. Added “NServiceBus.Integration” to command line arguments for console application project.

  • 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-17T15:49:17+00:00Added an answer on May 17, 2026 at 3:49 pm

    If you look at your logs, it is likely that NServiceBus is telling you that you need to have your publisher be configured to be transactional. The way to do that is to include .IsTransactional(true) after .MsmqTransport().

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I have a JSP page retrieving data and when single or double quotes are
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6

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.