Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

When opening a queue to read messages, the receiving application must specify how the messages are read from the queue and who else can access the queue when it is open.

The queue's access mode can be set to MQ_PEEK_ACCESS or MQ_RECEIVE_ACCESS. Use MQ_PEEK_ACCESS when you want to peek at messages without removing them. Use MQ_RECEIVE_ACCESS when you want to peek or retrieve the messages in the queue.

The queue's share mode can be set to MQ_DENY_NONE or MQ_DENY_SHARE_RECEIVE. When peeking at the messages in the queue, MQ_DENY_NONE must be specified. When retrieving messages, either setting can be used.

Both these modes are set when calling MSMQQueueInfo.Open.

Note:
Before opening a queue, Message Queuing verifies that the access mode requested by the application does not conflict with the access rights of the queue. If MQ_ERROR_ACCESS_DENIED is returned to the Open call, the queue's access control is blocking the application from opening the queue.
To open a queue to read messages
  1. Declare a MSMQQueueInfoand MSMQQueueobject.

  2. Obtain a MSMQQueueInfoobject.

    The C++ COM code example tries to create a new MSMQQueueInfoobject, ignoring any errors if a queue with the same pathname already exists. QueueInfoobjects for public queues can also be obtained from doing a query on the directory service.

  3. Call MSMQQueueInfo.Opento open the queue with receive or peek access.

    The following examples open the queue with receive access and deny none share mode.

  4. (Optional) Add code for retrieving messages from the queue.

  5. Call MSMQQueue.Closeto close the queue.

For a code example using C++ COM, see C++ COM Code Example: Opening a Queue to Read Messages.

See Also

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@systemmanager.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.