tags:

views:

842

answers:

2

I've created a WCF service to send a message to an MSMQ, I can get it to run and it looks like the message was sent but when looking at the queue it's not there. I've verified and the queue is not a transactional queue. Security is open so that everyone can send messages but I'm wondering if there are other places to set security? Here is my code I'm using.

Dim mq As MessageQueue
Dim msg As Message
Dim queueName As String = "webdevbvm.labsafety.com\emailsubscriptions"

Try
   msg = New Message("Test")
   msg.Priority = MessagePriority.Highest

   If (MessageQueue.Exists(queueName)) Then
       mq = New MessageQueue(queueName)
   msg.ResponseQueue = mq
   msg.UseJournalQueue = True
   msg.Label = "Test Message"
   msg.Body = "This is only a test"
   mq.Send(msg)
   Console.WriteLine("Message sent.")
   End If
Catch ex As MessageQueueException
   Console.WriteLine("MSMQ Error: " + ex.ToString())
Catch ex As Exception
   Console.WriteLine("Error: " + ex.ToString())
Finally
   mq.Close()
End Try

I get no errors but I do see the messages in my outgoing queue from the machine that is running the program. It shows the queue exists and if I change the queue name to one that doesn't exist it doesn't go into the IF statement so I know it's seeing the queue just not sending the file. If it helps I'm running the program locally on a laptop and the queue it's sending too is on a Windows 2003 server.

+1  A: 

That doesn't look like a WCF service to me - seems you're using the base System.Net.Messaging API to send message to your queue....

Check out some of these link to see how to use WCF to send messages to MSMQ:

Marc

marc_s
correct, but this is being done in a wcf service
Robert
why would a wcf service drop a message into MSMQ directly?
marc_s
why not sent it from the WCF service **using** WCF ??
marc_s
that is what I'm trying to figure out. I forgot to put in the post that I'm a newbie to both WCF services and MSMQ. I'll check out these articles and see what happens. thanks
Robert
@Robert: OK, check out if those resources make sense to you and answer your question and if not come back and ask again ;-)
marc_s
+1  A: 

Thanks marc for your response but I figured out what needed to be done. Basially I was using the wrong queue name. I didn't have "FormatName:DIRECT=OS:" in front of the queue name. Once I put that it was good to go. thanks again.

Robert

Robert
Robert, if this is the answer, then you should accept it as the answer.
John Saunders
Sorry forgot to accept it. thanks for the reminder.
Robert