gpt4 book ai didi

c# - 客户端不读取远程 MSMQ 队列,但可以发送到远程队列

转载 作者:太空宇宙 更新时间:2023-11-03 15:48:22 24 4
gpt4 key购买 nike

我用 C# 开发了 Windows 服务

我有带有 2 个专用队列的 Windows Server 2012:queueRequests 和 queueResponses。

我的队列不是事务性的

我有使用凭据 MyDomain\UserDeploy 执行控制台应用程序的客户端。

服务器中的 Windows 服务使用凭据 MyDomain\UserAgent 执行。

MyDomain\UserAgent 和 MyDomain\UserDeploy 用户对队列具有完全控制权:queueRequests 和 queueResponses。

服务器和客户端在同一个 MyDomain 中。

控制台应用程序客户端向服务器中的私有(private)队列发送消息和读取消息。

服务器中的 Windows 服务,用于从私有(private)队列发送消息和读取消息。

执行步骤:

  1. 控制台应用程序客户端将消息 A 发送到私有(private)队列服务器中的queuerequests

  2. Windows 服务从私有(private)队列 queuerequests 读取消息 A

  3. Windows 服务 sendMessage B 到私有(private)队列 queueresponses

  4. 控制台应用程序客户端从专用队列读取消息 B队列响应。

所有步骤都有效。

现在,我不知道原因,第 4 步失败了。 Client Not 从远程队列中读取消息。

我不明白为什么:客户端可以向队列发送消息,但不能从队列中读取。

我得到一个 MessageQueueException 但异常。消息是空的。

有什么好的故障排除建议吗?

片段代码:

    const string ForSend = @"FormatName:DIRECT=OS:{0}\private$\DeploymentCommands";
const string ForRead = @"FormatName:DIRECT=OS:{0}\private$\DeploymentResponses";

private DeploymentResponse WaitForResponse()
{
try
{
Message rsp = colaStatus.ReceiveByCorrelationId(correlationId, new TimeSpan(0, timeOut, 0));
DeploymentResponse ret = rsp.Body as DeploymentResponse;

Console.WriteLine("Respuesta WaitForResponse:" + ret.DeploymentId + " - " + ret.Status);
Trace.WriteLine("Respuesta WaitForResponse:" + ret.DeploymentId + " - " + ret.Status);
return ret;
}
catch (MessageQueueException ex)
{
Console.WriteLine("Error WaitForResponse in remote server " + remoteServer + ". " + ex.Message);
Trace.WriteLine("Error WaitForResponse in remote server " + remoteServer + ". " + ex.Message);
return null;
}
catch (Exception)
{
throw;
}
}

关于 MessageQueueException 的更多信息。

我明白了

消息:空
MessageQueueErrorCode -2147023169
错误代码-2147467259

但未在 MessageQueueErrorCode 枚举中找到该代码。

-2147023169 值。十六进制:800706BF

-2147467259 值。十六进制:80004005

关于这些代码的信息不多。只有我得到:

0x80004005 -2147467259 E_Fail
0x800706BF -2147023169 PRC_S_Call_Failed_DNE

Windows Update Codes

完整跟踪异常:

Message: - MessageQueueErrorCode -2147023169 - ErrorCode-2147467259 StackTrace:
at System.Messaging.MessageQueue.MQCacheableInfo.get_ReadHandle()

at System.Messaging.MessageQueue.ReceiveBy(String id, TimeSpan timeout, Boolean remove, Boolean compareId, Boolean throwTimeout, MessageQueueTransaction transaction, MessageQueueTransactionType transactionType)

at System.Messaging.MessageQueue.ReceiveByCorrelationId(String correlationId, TimeSpan timeout)

at DeploymentAgent.Client.DeploymentInvoker.WaitForResponse()

最佳答案

你可能会尝试的事情:

  1. 更改队列权限 - see here ,尝试将权限设置为“所有人”(仅用于测试)。
  2. 尝试在注册表中设置 AllowNonauthenticatedRPC - details here

关于c# - 客户端不读取远程 MSMQ 队列,但可以发送到远程队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27079278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com