Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to send information to a message queue

How to send information to a message queue

Scheduled Pinned Locked Moved ASP.NET
data-structurestutorial
9 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Goodberrie
    wrote on last edited by
    #1

    Hi there. I need to have some ASP page that sends and places information in a message queue, and also how to make the opposite, read from a message queue. (using windows message queuing.) Thanks in advance, Pedro Roriz

    B 1 Reply Last reply
    0
    • G Goodberrie

      Hi there. I need to have some ASP page that sends and places information in a message queue, and also how to make the opposite, read from a message queue. (using windows message queuing.) Thanks in advance, Pedro Roriz

      B Offline
      B Offline
      Bill Priess
      wrote on last edited by
      #2

      To accomplish this, you need to use the System.Messaging namespace. The process is fairly simple to use and implement. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmessaging.asp HTH, Bill P. Oakland, CA

      G 1 Reply Last reply
      0
      • B Bill Priess

        To accomplish this, you need to use the System.Messaging namespace. The process is fairly simple to use and implement. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmessaging.asp HTH, Bill P. Oakland, CA

        G Offline
        G Offline
        Goodberrie
        wrote on last edited by
        #3

        Hi! Thanks for the quick answer. I've managed to place a message in the queue, but now, trying to read it is being a little more complicated. I've searched the web for many pieces of code, tried a lot of possible ways, but always end up the same way: Set qQueue = Server.CreateObject ("MSMQ.MSMQQueueInfo") Set qMessage = Server.CreateObject ("MSMQ.MSMQMessage") qQueue.FormatName = "DIRECT=OS:pedro-roriz\aspq" Set qReceive = qQueue.Open(2,0) Set qMessage = qReceive.Receive (0 , true , true , 100) -- Here i get a error: Access is denied I went to my queue, and turned all permissions on to every user group that i found there...still nothing. Any help? Thanks Pedro Roriz

        B 1 Reply Last reply
        0
        • G Goodberrie

          Hi! Thanks for the quick answer. I've managed to place a message in the queue, but now, trying to read it is being a little more complicated. I've searched the web for many pieces of code, tried a lot of possible ways, but always end up the same way: Set qQueue = Server.CreateObject ("MSMQ.MSMQQueueInfo") Set qMessage = Server.CreateObject ("MSMQ.MSMQMessage") qQueue.FormatName = "DIRECT=OS:pedro-roriz\aspq" Set qReceive = qQueue.Open(2,0) Set qMessage = qReceive.Receive (0 , true , true , 100) -- Here i get a error: Access is denied I went to my queue, and turned all permissions on to every user group that i found there...still nothing. Any help? Thanks Pedro Roriz

          B Offline
          B Offline
          Bill Priess
          wrote on last edited by
          #4

          It looks like to me that you are trying to do it in client-side script. Is this correct? If that is the case, then I believe that you need to make sure that the MACHINENAME\IUSR_MACHINENAME account needs to have access to the queue, which I have heard is not a good idea. If you are using ASP.NET, then I would send and recieve the messages in the code-behind and do it that way. Much safer, IMHO. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmessagingmessagequeueclassreceivetopic.asp This is what I found on MSDN for receiving a message. HTH, Bill P. Oakland, CA


          -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


          G 1 Reply Last reply
          0
          • B Bill Priess

            It looks like to me that you are trying to do it in client-side script. Is this correct? If that is the case, then I believe that you need to make sure that the MACHINENAME\IUSR_MACHINENAME account needs to have access to the queue, which I have heard is not a good idea. If you are using ASP.NET, then I would send and recieve the messages in the code-behind and do it that way. Much safer, IMHO. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmessagingmessagequeueclassreceivetopic.asp This is what I found on MSDN for receiving a message. HTH, Bill P. Oakland, CA


            -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


            G Offline
            G Offline
            Goodberrie
            wrote on last edited by
            #5

            no, the code is being writen in server side. As for the code, it's in asp, not using asp.net. Just can't figure out why he keeps complaining! Thanks anyway. Pedro Roriz

            B 1 Reply Last reply
            0
            • G Goodberrie

              no, the code is being writen in server side. As for the code, it's in asp, not using asp.net. Just can't figure out why he keeps complaining! Thanks anyway. Pedro Roriz

              B Offline
              B Offline
              Bill Priess
              wrote on last edited by
              #6

              Hmmm, is the queue an authenticated queue? try turning off authentication on the queue and then see what happens. HTH, Bill P. Oakland, CA


              -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


              G 1 Reply Last reply
              0
              • B Bill Priess

                Hmmm, is the queue an authenticated queue? try turning off authentication on the queue and then see what happens. HTH, Bill P. Oakland, CA


                -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


                G Offline
                G Offline
                Goodberrie
                wrote on last edited by
                #7

                the default for the queue was already with authenticated turned off. In the general tag, i have: Limit message storage to (kb) turned off Authenticated off Nontransactional queue Privacy level set to optional and base priority to 0.

                G 1 Reply Last reply
                0
                • G Goodberrie

                  the default for the queue was already with authenticated turned off. In the general tag, i have: Limit message storage to (kb) turned off Authenticated off Nontransactional queue Privacy level set to optional and base priority to 0.

                  G Offline
                  G Offline
                  Goodberrie
                  wrote on last edited by
                  #8

                  I changed the code for the open method. Instead of using FormatName, I used PathName and Label. Now the error message is: "The queue does not exist, or you do not have sufficient permissions to perform the operation. " Any help? Thanks! Set qQueue = Server.CreateObject ("MSMQ.MSMQQueueInfo") Set qMessage = Server.CreateObject ("MSMQ.MSMQMessage") 'qQueue.FormatName = "DIRECT=OS:pedro-roriz\Testqueue2" qQueue.PathName = ".\TestQueue2" qQueue.Label = "Testqueue2" Set qReceive = qQueue.Open(2,0) If qReceive = Nothing then Response.write "Nothing opened" else Set qMessage = qReceive.Receive (0 , true , true , 100) if Not qMessage is Nothing then Response.Write "Body = " + qMessage.body else Response.Write "empty" end if end if

                  G 1 Reply Last reply
                  0
                  • G Goodberrie

                    I changed the code for the open method. Instead of using FormatName, I used PathName and Label. Now the error message is: "The queue does not exist, or you do not have sufficient permissions to perform the operation. " Any help? Thanks! Set qQueue = Server.CreateObject ("MSMQ.MSMQQueueInfo") Set qMessage = Server.CreateObject ("MSMQ.MSMQMessage") 'qQueue.FormatName = "DIRECT=OS:pedro-roriz\Testqueue2" qQueue.PathName = ".\TestQueue2" qQueue.Label = "Testqueue2" Set qReceive = qQueue.Open(2,0) If qReceive = Nothing then Response.write "Nothing opened" else Set qMessage = qReceive.Receive (0 , true , true , 100) if Not qMessage is Nothing then Response.Write "Body = " + qMessage.body else Response.Write "empty" end if end if

                    G Offline
                    G Offline
                    Goodberrie
                    wrote on last edited by
                    #9

                    Finally i got to receive the message from the queue. I'm placing here the code, just in case anyone needs it. Thanks for all the help Bill! dim body Set qQueue = Server.CreateObject ("MSMQ.MSMQQueueInfo") Set qMessage = Server.CreateObject ("MSMQ.MSMQMessage") qQueue.FormatName = "PUBLIC=fc3ebf19-bd12-4dfa-8029-e0062a5c7b2f" 'u get this ID in the properties of your queue Set qReceive = qQueue.Open(1,0) If qReceive.isopen then 'Response.write "

                    opened

                    " end if Set qMessage = qReceive.Receive (0 , true , true , 100) if Not qMessage is Nothing then body = qMessage.body Response.Write "

                    " + Body + "

                    " else Response.Write "Empty Queue" end if

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups