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 7088343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:47:21+00:00 2026-05-28T07:47:21+00:00

I’m testing NServiceBus on ASP.NET MVC3. At the moment, I’m able to send command

  • 0

I’m testing NServiceBus on ASP.NET MVC3. At the moment, I’m able to send command message to the backend and the message handler is listening to it. But when i try to publish the same message, the message handler is not listening.

The problem i found is that message is not published to the subscriber’s queue. When i debug and check NServiceBusHost console, it says

2012-01-19 22:53:35,042 [1] INFO  NServiceBus.Unicast.UnicastBus [(null)] <(null
)> - Subscribing to SampleMessage.Person1WasCreated, SampleMessage, Version=1.0.
0.0, Culture=neutral, PublicKeyToken=null at publisher queue Test-web

I checked my config settings again and again for few days and it seems correct for me . Can anyone please check for me what I’m missing? The thing I’m trying to do is to publish a message from the web and the message should be handle at the backend (ServiceHost2).

ASP.NET MVC3 Web.config

<configSections>
    <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
    <section name="MsmqSubscriptionStorageConfig" type="NServiceBus.Config.MsmqSubscriptionStorageConfig, NServiceBus.Core" />
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/>
  </configSections>
  <MsmqTransportConfig InputQueue="Test-web" ErrorQueue="Test-web-error" NumberOfWorkerThreads="1" MaxRetries="5" />
  <MsmqSubscriptionStorageConfig Queue="Test-subscriptionstorage" />

Global.asax.cs

protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            Global.Bus = Configure.WithWeb()
               .Log4Net()
                .CastleWindsorBuilder()
                .XmlSerializer()
                .MsmqTransport().IsTransactional(false)
                .UnicastBus()
                .LoadMessageHandlers()
                .MsmqSubscriptionStorage()
                .CreateBus()
                .Start()
                ;
        }

App.Config in ServiceHost2 Project

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
    <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
    <section name="MsmqSubscriptionStorageConfig" type="NServiceBus.Config.MsmqSubscriptionStorageConfig, NServiceBus.Core" />
  </configSections>
  <MsmqSubscriptionStorageConfig Queue="Service2-AC1-subscriptionstorage" />
  <MsmqTransportConfig InputQueue="Service2-AC1" ErrorQueue="Service2-AC1-Error" NumberOfWorkerThreads="1" MaxRetries="5" />
  <UnicastBusConfig>
    <MessageEndpointMappings>
    <add Messages="SampleMessage" Endpoint="Test-web" />
    </MessageEndpointMappings>
  </UnicastBusConfig>
  <appSettings>
    <add key="EndpointConfigurationType" value="ServiceHost2.EndpointConfig, ServiceHost2"/>
  </appSettings>
</configuration>

EndpointConfig for ServiceHost2

namespace ServiceHost2
{
    public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
    {
        public void Init()
        {
            Configure.With()
                .Log4Net()
                .CastleWindsorBuilder()
                .MsmqTransport()
                .MsmqSubscriptionStorage()
                .XmlSerializer()
                .UnicastBus().LoadMessageHandlers()
                ;
        }
    }
}

Method in the controller which publish the message

public ActionResult CreatePerson(Person p)
        {
            var Person1WasCreated = new Person1WasCreated {Id = p.Id,Name = p.Name};
            Global.Bus.Publish(Person1WasCreated);
            return View();
        }

Thanks.

  • 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-28T07:47:22+00:00Added an answer on May 28, 2026 at 7:47 am

    I think I found out why. I was reading on this article today about Why not publish NServiceBus messages from a web application?

    It states very clear that, message is not suppose to publish from the web. Somehow The subscription storage created by my web project doesn’t allow anything to subscribe to it.

    So my solution is, I send the command message from the web to a message handler in Service1, and publish a new event message to Service2. Even the event message is able to subscribe into Service1’s subscription storage.Everything works fine now. Thanks.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I want to construct a data frame in an Rcpp function, but when I
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.