Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6590445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:17:59+00:00 2026-05-25T17:17:59+00:00

I have a service, which inserts stuff into MSMQ via WCF. However, it can

  • 0

I have a service, which inserts stuff into MSMQ via WCF. However, it can be a long time before any messages are inserted into the queue, which is when the error for a non-existing queue would occur.

My idea is to loop through the WCF configuration and checking if the queue exists on startup. The MSMQ WCF endpoints have the address in the format net.msmq://machine/private/queue.

Given a WCF MSMQ address in the net.msmq format, how can I check if this queue exists without queuing an actual message?

Edit

The private queues can exist either on the same machine as the service, or on a remote server.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:17:59+00:00Added an answer on May 25, 2026 at 5:17 pm

    You can check if the queue exists with the MessageQueue.Exists method. Note you have to use the standard MSMQ addressing format which is

    FORMATNAME:DIRECT=OS:(server name)\PRIVATE$\(queue name) 
    

    However, checking that a message queue exists before initialising your sender kind of defeats the purpose behind using message queuing in the first place.

    One of the reasons you want to use queuing is that your sender does not need to know about the availability of the receiver endpoint. It doesn’t care because it can still send the message even if the receiver queue is unavailable.

    The reason it can do this is because MSMQ implements a store-and-forward messaging pattern, which means that any sent messages are first stored locally and then sent. This insulates the sender from failures on the destination endpoint and ensures messages won’t be lost.

    This also means that there will be no error message that the queue address is pointing to a queue which does not exist. The message will simply time out after a configurable time and be marked undeliverable.

    UPDATE As John Breakwell points out in his comment: Not so. The MSMQ message will be delivered to the remote queue manager and, if the queue does not exist, be discarded. Negative Source Journaling, if enabled, would put a copy of the discarded message in the sender’s corresponding Dead Letter Queue

    Hope this helps.

    UPDATE

    It occurred to me there is a situation where you would want to check for the existence of a queue before sending, which is if you are spawning your queue’s programmatically based on some business rule.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service which needs to insert into a SQL 2005 log
I have a service which takes the user supplied rich text (can have HTML
I have a WCF service which will be hosted under IIS. Now I have
I have a WCF service which accepts a string as a paramter for one
I have a WCF service which works on my dev machine running IIS 7,
I have a service which continuously writes data in a separate thread into SQL
So, we have a service that takes list of updates via a WCF service,
I have dao which basically inserts a record into a table using hibernate, this
I have a web service call that returns XML which I convert into domain
I have a service which has one endpoint , I have defined this endpoint

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.