VBScript Code Example: Creating a Queue
The following example creates a nontransactional public queue. The queue is created on a Web server using Active Server Pages and VBSript.
|By default, ASP pages run under the local IUSR_comptername account created by Internet Information Services (IIS). Therefore, by default, local users can create only local public queues and cannot create queues on a remote computer using ASP pages. However, administrators can change the default ASP permissions. In IIS, they can allow anonymous access through domain user accounts that can create queues, and in Message Queuing, they can allow everyone to create queues.|
Create the Queue for the Code Example
The following procedure lists the steps used to create the queue in the code example that follows.
To create a queue
Create an MSMQQueueInfo object.
Specify the path name of the queue. (In the following example, "." is used to indicate the local computer.)
|For Message Queuing servers and independent clients, the local machine is the local computer. However, for dependent clients, the local machine is the client's supporting server.|
Optional. Add any additional queue properties you need. (The following example also specifies the label of the queue using MSMQQueueInfo.Label
Call MSMQQueueInfo.Create to create the queue.
To run this example, paste the following code into a text file that has an .asp file extension (for example, mq.asp), and then place the file in the InetPub\Scripts folder on your Web server. (If you use another folder, make sure that folder has execute script privileges.) You can then run this script from your Internet browser by referring to the address: http ://<webservername>/scripts.mq.asp.
The following code contains no version specific Message Queuing calls.
<HTML> <BODY> <H1>Creating an MSMQ public queue on a Web server</H1> <% set qinfo = Server.CreateObject ("MSMQ.MSMQQueueInfo") qinfo.PathName = ".\TestQueue" qinfo.Label = "Test Queue" qinfo.Create %> </BODY> </HTML>