On Windows Server 2003, we back up messages in Windows message queue once a week using the following batch commands (http://technet.microsoft.com/en-us/library/cc773213%28v=ws.10%29.aspx):
cd "C:\backup"
echo y | del *.* /Q /s
echo y | mqbkup -b C:\backup
We have a C# ASP.NET 3.5 web application running on the same machine that interacts with this message queue.
After the backup runs, when we try to access the message queue from the web application, the web app. throws the following error (it goes away if the app is rebuilt, as expected). How do I fix it? Please help. Thanks.
*Server Error in '/' Application.
The Queue manager service has been restarted. The queue handle is stale and should be closed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Messaging.MessageQueueException: The Queue manager service has been restarted. The queue handle is stale and should be closed.
Source Error: Line 107: Message[] msgs = Global.getMessageQueue()[i].GetAllMessages();
Stack Trace:
[MessageQueueException (0x80004005): The Queue manager service has been restarted. The queue handle is stale and should be closed.]
System.Messaging.MessageEnumerator.get_Handle() +168
System.Messaging.MessageEnumerator.MoveNext(TimeSpan timeout) +103
System.Messaging.MessageEnumerator.MoveNext() +47
System.Messaging.MessageQueue.GetAllMessages() +41
engine.resultData.Page_Load(Object sender, EventArgs e) in C:\retentionSys_08\master\resultData.aspx.cs:107
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.4028*