gpt4 book ai didi

WCF 远程 MSMQ - 我可以写入远程队列,但无法接收

转载 作者:行者123 更新时间:2023-12-02 06:00:07 25 4
gpt4 key购买 nike

作业服务器:Windows Server 2008 R2.NET版本:4.5

我正在使用 WCF 连接两个服务器 - 应用队列。我希望应用能够从队列发送/接收消息。由于某种原因,应用程序可以发送消息,但无法接收消息。

netMsmq 绑定(bind)如下所示:

<binding name="JobExecutionerBinding" receiveErrorHandling="Move">
<security>
<transport msmqAuthenticationMode="None" msmqProtectionLevel="None" />
</security>
</binding>

服务绑定(bind)如下所示:

现在,客户端绑定(bind)如下所示:

<endpoint   address="net.msmq://queue/private/jobs" 
binding="netMsmqBinding"
bindingConfiguration="JobExecutionerBinding"
contract="JobExecution.Common.IJobExecutionService"
name="SimpleEmailService"
kind=""
endpointConfiguration=""/>

为了安全起见,我更改了一些名称。

因此,WC 客户端可以毫无问题地发送到远程队列。它甚至可以正确地对传出消息进行排队,并在远程队列服务器出现故障时将其转发。但每次启动 WCF 服务时,我都会得到以下信息:

There was an error opening the queue. Ensure that MSMQ is installed and running, the queue exists and has proper authorization to be read from. The inner exception may contain additional information. ---> System.ServiceModel.MsmqException: An error occurred while opening the queue:The queue does not exist or you do not have sufficient permissions to perform the operation. (-1072824317, 0xc00e0003). The message cannot be sent or received from the queue. Ensure that MSMQ is installed and running. Also ensure that the queue is available to open with the required access mode and authorization. at System.ServiceModel.Channels.MsmqQueue.OpenQueue() at System.ServiceModel.Channels.MsmqQueue.GetHandle() at System.ServiceModel.Channels.MsmqQueue.SupportsAccessMode(String formatName, Int32 accessType, MsmqException& msmqException) --- End of inner exception stack trace --- at System.ServiceModel.Channels.MsmqVerifier.VerifyReceiver(MsmqReceiveParameters receiveParameters, Uri listenUri) at System.ServiceModel.Channels.MsmqTransportBindingElement.BuildChannelListener[TChannel](BindingContext context) at System.ServiceModel.Channels.Binding.BuildChannelListener[TChannel](Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, BindingParameterCollection parameters) at System.ServiceModel.Description.DispatcherBuilder.MaybeCreateListener(Boolean actuallyCreate, Type[] supportedChannels, Binding binding, BindingParameterCollection parameters, Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, ServiceThrottle throttle, IChannelListener& result, Boolean supportContextSession) at System.ServiceModel.Description.DispatcherBuilder.BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, Boolean supportContextSession, IChannelListener& result) at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) at System.ServiceModel.ServiceHostBase.InitializeRuntime() at

我已经在 StackOverflow 和互联网上闲逛了 8 个小时。这是我所做的:

  • 确保匿名登录、Everyone、网络、网络服务和本地服务拥有完全控制权
  • 停止了远程 MSMQ 服务器并观察了 WCF 服务的作用,我收到了不同的错误 - 因此我确信 WCF 服务在启动时正在与 MSMQ 服务器通信
  • 在两个机器上禁用 Windows 防火墙并通过 EC2 安全组打开所有端口
  • 在注册表中将 AllowNonauthenticatedRpc 和 NewRemoteReadServerAllowNoneSecurityClient 设置为 1
  • 在两台服务器上配置了 MS DTC(队列是事务性的,但无论队列是否是事务性的,我都会收到相同的错误)
  • 确认如果我使用本地队列,WCF 服务器可以正常启动,并且接收没有问题

救命啊!!!如果没有远程排队解决方案,我无法扩展我的应用程序。

最佳答案

从您的帖子中不清楚哪个层无法读取,更重要的是哪个队列

但是,不支持以事务方式读取远程队列:

Message Queuing supports sending transactional messages to remote queues, but does not support reading messages from a remote queue within a transaction. This means that reliable, exactly-once reception is not available from remote queues. See Reading Messages from Remote Queues

我怀疑您的系统在某个地方仍在执行事务性远程读取,即使您提到您已禁用它。

从最佳实践的角度来看,即使你让它工作,你的设计也不会扩展,这很遗憾,因为这是你提到的你想要的东西。

Remote reading is a high-overhead and therefore inefficient process. Including remote read operations in an application limits scaling. 1

您应该始终远程写入而不是远程读取。

更好的方法是插入 message broker或充当消息传递中心点的路由器服务。您的应用队列服务(顺便说一句,名称很容易混淆)应该仅从本地队列中以事务方式读取

  • 应用应以事务方式读取其本地队列
  • 应用应以事务方式发送至远程代理
  • 代理以事务方式读取本地队列
  • 代理以事务方式发送到远程队列

类似地,如果您的队列层想要回复上述过程,则会发生相反的过程。

稍后,如果您希望提高性能,可以引入 Dynamic router它根据动态规则集或压力水平等环境条件将消息重定向到另一台计算机上的不同远程队列。

关于WCF 远程 MSMQ - 我可以写入远程队列,但无法接收,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11596382/

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