1
votes

I want to test out the possibility of queuing message on remote clients who may or may not be connected, those clients when connected will push the messages sent to an msmq over the internet that is hosted in IIS 6.

Now, I setup MSMQ on the win server2003 hosting IIS. After I did this "MSMQ" shows up in the IIS default web site.

Ok, then I added a new transactional private queue through computer management-> message queuing.

From there all I want to do is see messages stack up, I'll deal with those after this works.

Now, I made a client app that has the following code:

     using (var contract = new HttpMsmqBridgeProxy())
     {
        var valueToSend = 2456;
        contract.TestFunction(valueToSend);
        Console.WriteLine("value sent: " + valueToSend + "\r\n");
     }

Here's the app.config of this client:

 <configuration>
  <system.serviceModel>
    <client>
      <endpoint
        address="net.msmq://**.**.***.228/private/MarksTestHttpQueue"
        binding="netMsmqBinding"
        bindingConfiguration="srmpBinding"
        contract="HttpMsmqBridgeLibrary.IHttpMsmqBridgeContract">
      </endpoint>
    </client>
    <bindings>
      <netMsmqBinding>
        <binding name="srmpBinding"
                 queueTransferProtocol="Srmp">
          <security mode="None"/>
        </binding>
      </netMsmqBinding>
    </bindings>
  </system.serviceModel>
</configuration>

The IP is my public facing IP that works, I can host a wcf service or webpage just fine. I followed this guide somewhat for using srmpBinding.

http://msdn.microsoft.com/en-us/library/aa395217.aspx

So, in short what happens when I run the app is it succeeds, tells me it was sent, I go into Message Queue of my client and see that a new queue has shown up in Outgoing folder called:

Direct:http://..*.228/msmq/private$/MarksTestHttpQueue

there is no outgoing messages waiting in this queue so I assume the message was sent.

When I look at my msmq now on the winserver2003 there are no arrived queued messages waiting.

ETA: I can send messages to a non-transactional queue using the classic MessageQueue implimintation:

     var queue = new MessageQueue("FormatName:DIRECT=http://**.**.***.228/msmq/private$/nonTransQueue");
     System.Messaging.Message Msg;
     Msg = new System.Messaging.Message();
     Msg.Formatter = new ActiveXMessageFormatter();
     Msg.Body = "Testing";
     queue.Send(Msg);

The messages show up (after altering the mapping file in the system32/msmq/mapping directory) just fine. I'm wondering if because it's IIS6 I won't be able to send using the net.msmq binding.

1
If you send to a transactional queue over HTTP, the sender needs MSMQ with HTTP support installed locally to receive the ACK messages being sent back by the destination. Sending to non-transactional queues does not.John Breakwell

1 Answers

1
votes

You are correct in that your WCF service hosted in IIS6 won't be able to process the messages. This is because IIS6 doesn't use WAS which instantiates processes for non-http requests. But I think that this comes after everything you're doing in the workflow. I would expect

  • you run your client, pushing the message to the remote queue
  • the message appears in the remote queue
  • your WCF service does not pickup the message because it's hosted in IIS6, so you are left with a message in the remote queue.

I don't believe that IIS is involved at all up until the point where it wouldn't be working anyway.

A simple test for this is to self host your service on the server, e.g. run it in a console app. It will be able to accept MSMQ messages just as IIS7 would, and will remove that as a potential problem from your rig.

You might also want to test whether you can push a message directly from the client to a transactional queue on the server. If you're having problems sending messages to transactional queues on other machines then you can possibly check the MSDTC log. I don't envy having to delve into there.