如何修复“队列句柄已过时,应该关闭?”

问题描述 投票:0回答:1

在 Windows Server 2003 上,我们使用以下批处理命令每周一次备份 Windows 消息队列中的消息 (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

我们有一个 C# ASP.NET 3.5 Web 应用程序运行在与此消息队列交互的同一台计算机上。

备份运行后,当我们尝试从Web应用程序访问消息队列时,Web应用程序。抛出以下错误(如果按预期重建应用程序,该错误就会消失)。 我如何解决它?请帮忙。谢谢。

*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*
c#-2.0 asp.net-3.5 windows-server-2003 message-queue windows-messages
1个回答
0
投票

我必须删除并重新创建队列才能解决过时的句柄错误。之后还必须授予适当的权限。

© www.soinside.com 2019 - 2024. All rights reserved.