简体   繁体   English

在远程计算机上找不到MSMQ消息

[英]Cannot find MSMQ message at remote computer

I have a WCF service that is set up to use MSMQ to transmit to a service on another machine. 我有一个WCF服务,该服务设置为使用MSMQ传输到另一台计算机上的服务。 We are trying to move the client onto a different machine, but it's not working. 我们正在尝试将客户端移动到另一台计算机上,但是它不起作用。 Enabling the MSMQ.End2End event log gives us 启用MSMQ.End2End事件日志可以使我们

Message with ID {6940f8fa-3d31-4db0-ae2b-59bc98c99f2c}\25321 was sent to queue DIRECT=OS:iisapp1-vvpm\private$\TransactionalEmailService/TransactionalEmail.Service.TransactionalEmailService.svc

which makes me think that it is working correctly from our machine, but we can't find any trace of it on the target machine. 这使我认为它可以在我们的机器上正常工作,但是在目标机器上找不到任何痕迹。 The service is not being invoked, and we can't find the message in the dead-letter queue (or anywhere else we can think of to look). 该服务没有被调用,我们无法在死信队列(或其他我们认为可以查找的地方)中找到消息。

Also, running the code directly from Visual Studio on my machine causes it to work. 另外,直接从计算机上的Visual Studio运行代码也会使其正常工作。

Changing the receiving queue to the DEV machine also causes the code to work, which makes me further think it's a problem with the receiving machine. 将接收队列更改为DEV计算机也会导致代码正常工作,这使我进一步认为这是接收计算机存在的问题。 (I just have no idea what) (我不知道是什么)

UPDATE 1: I came back to it and noticed all the messages I tried to send in the transactional dead-letter queue. 更新1:我回到它,并注意到我尝试在事务性死信队列中发送的所有消息。 The error message is "the time-to-reach-queue has elapsed". 错误消息是“到达队列的时间已过”。 Looking at the connection state, it's inactive, and sending another message won't cause it to become connected. 查看连接状态,它处于非活动状态,发送另一条消息不会导致它变为连接状态。 I restart the machine, and it is "Connected" again. 我重新启动计算机,然后再次“连接”。 I try to send the message again, and look at the queue state. 我尝试再次发送消息,并查看队列状态。 There are 12 messages, all of which are unacknowledged (0 are unprocessed). 有12条消息,所有消息均未确认(0个未处理)。

So it started happening again once the the endpoint machine got restarted. 因此,一旦端点计算机重新启动,它便再次开始发生。 I came across this article, which was the real solution: 我碰到了这篇文章,这是真正的解决方案:

http://blogs.msdn.com/b/johnbreakwell/archive/2007/02/06/msmq-prefers-to-be-unique.aspx http://blogs.msdn.com/b/johnbreakwell/archive/2007/02/06/msmq-prefers-to-be-unique.aspx

( In case the link goes away: ) (以防链接消失:)

It looks like there is an ID in MSMQ that is sent as part of the message. 看起来MSMQ中有一个ID作为消息的一部分发送。 The remote host uses that ID as a key into a cache to determine who to send the ack back to. 远程主机使用该ID作为缓存中的密钥,以确定将确认发送回给谁。 If you clone a machine, it gets the same value in the registry for that ID, which makes the other machine not know who to send it back to. 如果克隆一台计算机,则该计算机在注册表中将获得该ID的相同值,这会使另一台计算机不知道将其发回给谁。 So it will send it to the wrong machine, which will discard it, and the other machine will be stuck with a bunch of messages it keeps trying to send. 因此它将把它发送到错误的计算机上,然后将其丢弃,而另一台计算机将被一堆它一直试图发送的消息所卡住。 This also explains why it just started working one day... the cache expired and the "correct" machine got put in as the endpoint. 这也解释了为什么它只是一天开始工作...缓存过期,并且将“正确的”计算机用作端点。

Reinstalling MSMQ on the cloned machine fixes the issue. 在克隆的计算机上重新安装MSMQ可以解决此问题。

I'm really not sure this may be the case here (I don't have any experience with WCF in the context of MSMQ), but one of the more common reasons of this kind of behaviour you're talking of is missing the obligatory camel casing on FormatName in your queue name when using a MessageQueue constructor (like 'FormatName:DIRECT=...'), or getting the name somehow wrong. 我真的不确定在这里可能是这种情况(我在MSMQ的背景下没有使用WCF的经验),但是您正在谈论的这种行为的更常见的原因之一就是没有必要使用MessageQueue构造函数(例如'FormatName:DIRECT = ...')或在某种程度上弄错名称时,队列名称中FormatName上的驼色框。 The queue name in the message looks a bit odd with the svc ending, but that could just be a WCF thing? 消息中的队列名称与svc结尾有些奇怪,但这可能只是WCF的事情? Hope this helps at least getting you on the right direction. 希望这至少有助于您朝正确的方向发展。

Not sure what to say here, but it works now. 不知道在这里说什么,但现在可以使用。 Reading some stuff helped point me to the status of the queue (click on Outgoing Queues under Features/Message Queueing). 阅读一些内容有助于使我了解队列的状态(单击“功能/消息队列”下的“传出队列”)。 From there I found this KB article with a hotfix: http://support.microsoft.com/kb/976438 It didn't seem like it was applicable, but the symptoms people were having were all the same. 从那里,我发现此知识库文章带有修补程序: http : //support.microsoft.com/kb/976438似乎不适用,但是人们遇到的症状都是相同的。 Our guys tried to install it, but it failed and they didn't restart... but for some reason the message queues started working. 我们的人员尝试安装它,但是失败了,并且没有重新启动...但是由于某种原因,消息队列开始工作。

If someone comes along with some insight, I'll gladly upvote them or give them the bounty (if it's soon enough). 如果有人提出了一些见解,我会很乐意为他们投票或给予他们赏金(如果足够的话)。 But I'll just accept this as the answer for now. 但是,我现在将其作为答案。

This is usually caused by permissions on the remote queue, usual scenario is if you are using a private queue and this is accessed remotely by your wcf service. 这通常是由远程队列上的权限引起的,通常的情况是,如果您使用的是专用队列,并且可以通过wcf服务进行远程访问。

Try using a public queue. 尝试使用公共队列。

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

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