Click here to Skip to main content
13,253,507 members (51,384 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I've created a public queue and sent some messages to the queue using a windows service application. The sending application executes on the same server as the queue (i.e. this is a local queue).

After restarting the server, all of the queued messages were purged. Is there any way to persist these messages after a server restart?
Posted 21-Mar-13 5:52am
Sergey Alexandrovich Kryukov 21-Mar-13 10:57am
Why would you restart the service if some messages are not yet processed then?
saumil.sapariya 22-Mar-13 0:54am
Services restarted Automatically when Application pools are recycled. plz have any suggestion? post on it. Thanks :)
Well, a service handles some system events; including all cases when it is stopped. You can use it for completion of queue processing...
saumil.sapariya 22-Mar-13 6:19am
Below Case (I noticed following case service restarted and first message lost-
(not reach a MSMQ queue))
1) When WCF Service Deploy at time first message send it lost.
2) When Service.svc file load at time message lost.
3) When Pool recycled at this time first message lost.

I received a message form queue it's separate thread it's continue running.
Prasad Khandekar 21-Mar-13 11:31am
Please refer to this ( libray article to know more about reliable messaging with MQ.
saumil.sapariya 22-Mar-13 0:59am

my sample code such as above stackover flow question.
Can i achieve simple queue? or Will I need transaction queue for recovery of loss message??
plz post if u have any suggestion?
Thankx :)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

To achieve this you have to mark the messages as Recoverable. By default, MSMQ messages are only held in memory, but Recoverable messages are backed to disk to enable reliable MSMQ Messaging.

using System.Messaging;

Message recoverableMessage = new Message();
recoverableMessage.Body = "Sample Recoverable Message";
recoverableMessage.Recoverable = true;
MessageQueue msgQ = new MessageQueue(@".\$private\Orders");

Details can be found at the below link:-[^]
saumil.sapariya 22-Mar-13 9:23am
I tried for this same code. I also set Message queue Acknowledge Property but Message Acknowledge gave send message true but message don't send to Queue (Message Lost).Acknowledge message or MSMQ trace also send a message to Particular Queue but Queue not receiver a message Is there any Error Or Exception?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171114.1 | Last Updated 22 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100