We have an ongoing problem with message writes to MSMQ being very slow. Our queue is on Windows Server 2008 SP2. The queue is a public queue, addressed at "servername\queuename".

The code to send a message to the queue is

MessageQueue queue = new MessageQueue(Settings.Default.DefaultDestinationQueue);
queue.Formatter = new BinaryMessageFormatter();


The message that we're trying to send is simply a "PublishMessage", as follows:

public class PublishMessage {
    public int EntryId {get; set; }

We're seeing the messages actually reach the queue, but logging before and after shows that it's generally taking in excess of 1 minute for each message.

At this time, we can't see anything wrong with our queue configuration, but are not queuing experts--this is the first addition to this application. Anyone have any ideas?

Edit: Our server is running SP 2 (not SP1 that I originally stated). Running an instance directly on the machine hosting the queue is fast, any other is not.

Note: I've crossposted this at https://stackoverflow.com/questions/6083070/msmq-write-taking-1-minute


Our problem turned out to be an infrastructure issue with servers not properly authenticating. Our sysadmin finally got it straightened out by reconfiguring the server hosting the queue.


Could you please clarify "logging before and after shows that it's generally taking in excess of 1 minute for each message." Are you logging directly before and after the send() ? Or is there more code in between the two logging lines? The send() passes the message to the local queue manager to deliver to the remote queue manager. Any logging will just show when the message went into the outgoing queue and not when it was delivered.

I would rely on performance monitor to show exactly when messages leave one machine and arrive at the other.

Most delays I have seen are:

  • delays within the sending application
  • DNS/name resolution issues (but this should just delay the first message as after that the connection is up and running).

Have a look at the outgoing queue when you send a message to see if the connection is pending.

Is the delay consistent?

John Breawkell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.