简体   繁体   English

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

[英]Client Not read remote MSMQ queue, but can send to remote queue

I have Windows Service developed in C# 我有用C#开发的Windows服务

I have Windows Server 2012 with 2 private queues: queueRequests and queueResponses. 我有带有2个专用队列的Windows Server 2012:queueRequests和queueResponses。

My queues are not transactional . 我的队列不是事务性的

I have Client that execute Console Application with credentials MyDomain\\UserDeploy . 我有使用凭据MyDomain \\ UserDeploy执行控制台应用程序的客户端。

Windows Service in Server is executed with credentials MyDomain\\UserAgent. 服务器中的Windows服务使用凭据MyDomain \\ UserAgent执行。

MyDomain\\UserAgent and MyDomain\\UserDeploy user has Full control about queues: queueRequests and queueResponses. MyDomain \\ UserAgent和MyDomain \\ UserDeploy用户对队列具有完全控制权:queueRequests和queueResponses。

Server and Client are in the same MyDomain. 服务器和客户端在同一MyDomain中。

Console Application Client to send message and read message from/to private queue in Server. 控制台应用程序客户端从服务器中的专用队列发送消息和从中读取消息。

Windows Service in Server to send message and read message from/toprivate queue. 服务器中的Windows服务,用于从/专用队列发送消息和读取消息。

Execution Steps: 执行步骤:

  1. Console Application Client send Message A to private Queue queuerequests in Server 控制台应用程序客户端将消息A发送到服务器中的专用队列队列请求

  2. Windows Service read Message A from private queue queuerequests Windows Service从专用队列队列请求中读取消息A

  3. Windows Service sendMessage B to private queue queueresponses Windows Service sendMessage B到专用队列队列响应

  4. Console Application Client read Message B from private queue queueresponses. 控制台应用程序客户端从专用队列队列响应中读取消息B。

It was working all steps. 它正在所有步骤中工作。

Now, I don't know the reason, the step 4 fails. 现在,我不知道原因,步骤4失败。 Client Not reads message from remote queue. 客户端不读取远程队列中的消息。

I don't understand why: Client can send message to queue, but not reads from queue. 我不明白为什么:客户端可以将消息发送到队列,但不能从队列中读取消息。

I get a MessageQueueException but exception.Message is empty. 我收到一个MessageQueueException但异常。 消息为空。

Any suggestions for get good troubleshooting ? 有什么建议可以很好地排除故障吗?

Fragment code: 片段代码:

    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;
            }
        }

More about MessageQueueException . 有关MessageQueueException的更多信息。

I get 我懂了

Message: null 讯息:空
MessageQueueErrorCode -2147023169 MessageQueueErrorCode -2147023169
ErrorCode -2147467259 错误代码-2147467259

but not found that code in MessageQueueErrorCode Enumeration. 但在MessageQueueErrorCode枚举中找不到该代码。

-2147023169 value. -2147023169值。 In Hex: 800706BF 十六进制: 800706BF

-2147467259 value. 值-2147467259。 In Hex: 80004005 十六进制: 80004005

Not much info about those codes. 关于这些代码的信息不多。 Only I get: 只有我得到:

0x80004005 -2147467259 E_Fail 0x80004005 -2147467259 E_Fail
0x800706BF -2147023169 PRC_S_Call_Failed_DNE 0x800706BF -2147023169 PRC_S_Call_Failed_DNE

Windows Update Codes Windows更新代码

Full trace exception: 完全跟踪异常:

Message: - MessageQueueErrorCode -2147023169 - ErrorCode-2147467259 StackTrace: 消息:-MessageQueueErrorCode -2147023169-ErrorCode-2147467259 StackTrace:
at System.Messaging.MessageQueue.MQCacheableInfo.get_ReadHandle() 在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) 在System.Messaging.MessageQueue.ReceiveBy处(字符串ID,TimeSpan超时,布尔值移除,布尔值compareId,布尔值throwTimeout,MessageQueueTransaction事务,MessageQueueTransactionType transactionType)

at System.Messaging.MessageQueue.ReceiveByCorrelationId(String correlationId, TimeSpan timeout) 在System.Messaging.MessageQueue.ReceiveByCorrelationId(String relatedId,TimeSpan超时)处

at DeploymentAgent.Client.DeploymentInvoker.WaitForResponse() 在DeploymentAgent.Client.DeploymentInvoker.WaitForResponse()

Things you might try: 您可以尝试的操作:

  1. Changing queue permissions - see here , try setting permission to "Everyone" (for the test only). 更改队列权限- 请参阅此处 ,尝试将权限设置为“所有人”(仅适用于测试)。
  2. Try setting AllowNonauthenticatedRPC in registry - details here 尝试在注册表中设置AllowNonauthenticatedRPC 详细信息在这里

May you should consider to use public instead of private queues. 也许您应该考虑使用public队列而不是private队列。 Read the following articles of the advantages of public queues: 阅读以下有关公共队列优点的文章:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM