简体   繁体   English

使用Authenticate复选框选中是否将消息发送到私有MSMQ队列?

[英]Sending message to private MSMQ queue with Authenticate checkbox checked?

Before posting this question, I searched through all forum threads. 在发布此问题之前,我搜索了所有论坛帖子。 I found that my issue is similar to the Sending to authenticated queue However that thread doesn't really answered my question. 我发现我的问题类似于发送到经过身份验证的队列但是该线程并没有真正回答我的问题。

I have following setup (using .NET applications and MSMQ) 我有以下设置(使用.NET应用程序和MSMQ)

  • Installed MSMQ with Active Directory Services Integrated mode on my Windows7 64 bit machine. 在我的Windows7 64位计算机上安装了具有Active Directory服务集成模式的MSMQ
  • I have created two private Queues (PQ1 and PQ2) as a Transactional queues and configured its Security tab to give full access to domain user id (domain user id which is also Administartor on Win7 machine). 我创建了两个私有队列(PQ1和PQ2)作为事务性队列,并配置其安全选项卡以提供对域用户ID的完全访问权限(域用户ID,也是Win7机器上的Administartor)。
  • In my project I have three .NET 4.0 applications which are hosted by Windows Service (running with the access rights of same domain user id) on this Windows 7 machine 在我的项目中,我有三个.NET 4.0应用程序,它们由Windows服务(在同一个域用户ID上运行,具有相同域用户ID的访问权限)托管在这台Windows 7机器上
  • First .NET application is running on its own thread that reads data from database and sends MSMQ message to PQ1 queue 第一个.NET应用程序在其自己的线程上运行,该线程从数据库读取数据并将MSMQ消息发送到PQ1队列
  • Second and third are WCF applications (say wcfA and wcfB) self hosted from Windows service. 第二个和第三个是从Windows服务自托管的WCF应用程序(比如wcfA和wcfB)。
  • wcfA and wcfB are configured for MsmqIntegrationBinding with Transport security mode with properties mqAuthenticationMode set to "WindowsDomain" and msmqProtectionLevel set to "EncryptAndSign" wcfA和wcfB配置为具有传输安全模式的MsmqIntegrationBinding,其中属性mqAuthenticationMode设置为“WindowsDomain”,msmqProtectionLevel设置为“EncryptAndSign”
  • wcfA picks up messages from PQ1 and then processes the message and send another MSMQ message to PQ2 wcfA从PQ1接收消息,然后处理该消息并向PQ2发送另一条MSMQ消息
  • wcfB picks up the messages from PQ2 and proccesses it wcfB从PQ2中获取消息并进行处理

Note that everything works OK in above setup. 请注意,在上面的设置中一切正常。

However the issue starts when I enable the "Authenticated" checkbox for the private Queues PQ1 and PQ2 on its General tab . 但是,当我在其常规选项卡上启用专用队列PQ1和PQ2的“已验证”复选框时,问题就开始了 After this settings, the first application sends the MSMQ message to private queue but it ends up in "Transaction dead-letter messages" queue. 在此设置之后,第一个应用程序将MSMQ消息发送到专用队列,但它最终在“事务死信消息”队列中。 I tried adding Authenticated Users group to the Queue security tab and giving full access but it did not work. 我尝试将Authenticated Users组添加到Queue安全选项卡并提供完全访问权限,但它不起作用。

Further to this I also observed that the Sender tab on Property page of the message that goes to dead-letter queue reads Authenticated: No 除此之外,我还观察到去死信队列的消息的Property页面上的Sender选项卡读取Authenticated:No

Your help is highly appreciated to make the applications work with Authenticated Queue. 非常感谢您的帮助,使应用程序与Authenticated Queue一起使用。

After initializing a Message object, set the UseAuthentication property to true . 初始化Message对象后,将UseAuthentication属性设置为true

Example for sending a message to an authenticated queue: 将消息发送到经过身份验证的队列的示例:

private void SendToQueue(string queueMessage)
{
   var message = new System.Messaging.Message(queueMessage);
   message.UseDeadLetterQueue = true;            

   // This line resolved issue for sending message to queue with Authenticate checkbox checked. 
   message.UseAuthentication = true; 

   var queue = new System.Messaging.MessageQueue(@"FormatName:Direct=OS:.\private$\PQ1");
   queue.Send(message, MessageQueueTransactionType.Single);
}

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

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