This project is read-only.

Duplex MSMQ and a Web Application as client

Mar 4, 2010 at 6:31 PM

Dear Slashene,

Firstly, I would like to thank you for sharing this really great work!

I've been trying to adapt the code to another application that uses a Website as the client.
Until now I haven`t had much success though.

The server side code is pretty much the same as the one distributed in the website.
The web client side looks like this:

protected void Page_Load(object sender, EventArgs e)
    {
        bind = BindingFactory.Create(new Uri("net.msmq://localhost/private/servicovisionsaida"));
        objCliente = new Service1();
        channel = new DuplexChannelFactory<IService1>(objCliente, bind, new EndpointAddress("net.msmq://localhost/private/servicovisionentrada"));
        try
        {
            channel.CreateChannel().EnviaComando("RequisitaEstados", "cliente");
        }
        catch (Exception ex) 
        {
            Response.Write("Erro: Não foi possível pegar o valor das variáveis no servidor <br> " + ex.ToString());
        }
    }
protected void Page_Load(object sender, EventArgs e)
    {
        bind = BindingFactory.Create(new Uri("net.msmq://localhost/private/client"));
        objCliente = new Service1();
        channel = new DuplexChannelFactory<IService1>(objCliente, bind, new EndpointAddress("net.msmq://localhost/private/server"));

        try
        {
            channel.CreateChannel().ExecutaComando("RequisitaEstados", "cliente");
        }
        catch (Exception ex) 
        {
            Response.Write("Erro: " + ex.ToString());
        }
    }
Apparently, no data is being received by the client.
Is it possible or should I approach the issue in another way?

Thanks in advance!
Luiz Cançado

 

Apr 27, 2010 at 9:29 AM

Hi luizcancado,

 

Sorry to reply a bit later, maybe you have already found a solution.

In my experience, if ExecutaCommando does not throw any exception, it means that you queue is transaction and you are not in a transaction.

When this is the case MSMQ fails silently to send the message to the client... yes it sucks.

So two solution :

-Wrap the call with a TransactionScope,

-Disable transactional queue on the client

May 19, 2010 at 4:01 AM

Hi slashene,

Provisionally, I'm establishing the connection without MQ for that application, 
but wrapping it in a transational scope seems to be a better idea.

Thank you very much for the help!

Luiz Cançado