2
votes

I have Windows Service developed in C#

I have Windows Server 2012 with 2 private queues: queueRequests and queueResponses.

My queues are not transactional.

I have Client that execute Console Application with credentials MyDomain\UserDeploy .

Windows Service in Server is executed with credentials MyDomain\UserAgent.

MyDomain\UserAgent and MyDomain\UserDeploy user has Full control about queues: queueRequests and queueResponses.

Server and Client are in the same 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.

Execution Steps:

  1. Console Application Client send Message A to private Queue queuerequests in Server

  2. Windows Service read Message A from private queue queuerequests

  3. Windows Service sendMessage B to private queue queueresponses

  4. Console Application Client read Message B from private queue queueresponses.

It was working all steps.

Now, I don't know the reason, the step 4 fails. 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.

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 .

I get

Message: null
MessageQueueErrorCode -2147023169
ErrorCode -2147467259

but not found that code in MessageQueueErrorCode Enumeration.

-2147023169 value. In Hex: 800706BF

-2147467259 value. In Hex: 80004005

Not much info about those codes. Only I get:

0x80004005 -2147467259 E_Fail
0x800706BF -2147023169 PRC_S_Call_Failed_DNE

Windows Update Codes

Full trace exception:

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()

2
Are you using transactions? Can you add few lines of code with reading/writing part? Are you getting any exceptions?b2zw2a
Try catching exception and check MessageQueueErrorCode. Could you also show the Path you are using to access remote private queue?b2zw2a

2 Answers

0
votes

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
0
votes

May you should consider to use public instead of private queues. Read the following articles of the advantages of public queues: