Question

We are using MassTransit in a Request/Response model in our web application. We are able to send requests and receive responses. For testing/Debugging purposes We are setting the HandleTimeOut on the Response Handler to 1 hour. The problem is when the server fails to send a response , I am not able to do anything on the client side(I cannot access any other page). The application server does not respond to any other requests from the browser until the IIS is reset. Is this expected behavior. If it is can someone throw some light on why IIS is not responding to any other page requests and if there is a way to change that behavior.

I am registering the bus in an autofac Module

builder.Register(c => ServiceBusFactory.New(sbc =>
        {
            sbc.UseMsmq();
            sbc.VerifyMsDtcConfiguration();
            sbc.VerifyMsmqConfiguration();
            sbc.ReceiveFrom("msmq://localhost/MassTransit_ClientQueue");
            sbc.UseBinarySerializer();
            sbc.SetCreateTransactionalQueues(false);
        })).As<IServiceBus>().SingletonScoped();

My client code looks like this

var bus = IoC.Resolve<IServiceBus>();
bus.GetEndpoint(new Uri("msmq://localhost/MassTransit_ServerQueue"))
                        .SendRequest(new Message(), bus, rc =>
                        {
                            rc.HandleTimeout(new TimeSpan(1, 0, 0),
                                () => { });
                            rc.Handle<MessageResponse>(resmess =>
                            {

                            });
                            rc.Handle<MassTransit.Fault<Message>>
                                (resmess =>
                                    {

                                    });
                        });
Was it helpful?

Solution

The reason is that your user for your ASP.Net web application has basically serialized access to your web application - you can't have parallel requests in ASP.Net for a single user session id, unless you are calling a custom HttpHandler that doesn't have the interface IRequiresSessionState implemented.

So, if you don't get a response, and you wait an hour for a timeout, you won't get to make more http requests for that user for that hour for that app domain, until the thread you tied up waiting for a message has timed out.

OTHER TIPS

It might be due to MassTransit not being configured to handle more than one message at a time.

http://readthedocs.org/docs/masstransit/en/latest/configuration/config_api.html#bus-tuning-options

ServiceBusFactory.New(sbc =>
{
  //...
  sbc.SetConcurrentConsumerLimit(5); //try setting this to a larger number.
  //...
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top