Microsoft.ServiceBus.InvalidRequestException:连接失败。缓存刷新超时

Posted

技术标签:

【中文标题】Microsoft.ServiceBus.InvalidRequestException:连接失败。缓存刷新超时【英文标题】:Microsoft.ServiceBus.InvalidRequestException: The connection was failed. Cache refresh timed out 【发布时间】:2018-08-14 12:38:27 【问题描述】:

。服务器堆栈跟踪:Microsoft.ServiceBus.RelayedSocketInitiator.Connect(Uri uri, TimeSpan timeout) at Microsoft.ServiceBus.ConnectivityModeConnectionInitiator.Connect(Uri uri, TimeSpan timeout) at Microsoft.ServiceBus.Channels.BufferedConnectionInitiator.Connect(Uri uri, TimeSpan timeout) ) 在 Microsoft.ServiceBus.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout) 在 Microsoft.ServiceBus.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout) 在 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 在 System.ServiceModel.Channels。 CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) 在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies .RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 在 Syst em.ServiceModel.ICommunicationObject.Open()

使用 NetTcpRelayBinding 打开连接时

try

   NetTcpRelayBinding netTcpRelay = new NetTcpRelayBinding();
   if (ApplicationServer.Common.Utilities.ServicesConfigurationManager.ClientMaxConnections > 0)
   
     netTcpRelay.MaxConnections = ApplicationServer.Common.Utilities.ServicesConfigurationManager.ClientMaxConnections;
    
    netTcpRelay.MaxReceivedMessageSize = ApplicationServer.Common.Utilities.ServicesConfigurationManager.ClientMaxReceivedMessageSize;
    if (ApplicationServer.Common.Utilities.ServicesConfigurationManager.ClientSendTimeout > 0)
    
     netTcpRelay.SendTimeout = new TimeSpan(0, 0, ApplicationServer.Common.Utilities.ServicesConfigurationManager.ClientSendTimeout);
     

   if (ApplicationServer.Common.Utilities.ServicesConfigurationManager.ClientReceiveTimeout > 0)
    
      netTcpRelay.ReceiveTimeout = new TimeSpan(0, 0, ApplicationServer.Common.Utilities.ServicesConfigurationManager.ClientReceiveTimeout);
      

    channelFactory = new ChannelFactory<TServiceChannel>(
                               netTcpRelay,
                               new EndpointAddress(serviceBusUri));

                    // Set the signature token
                    policyName = ...
                    accessKey = ...
                    channelFactory.Endpoint.Behaviors.Add(new TransportClientEndpointBehavior  TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(policyName, accessKey) );
                
                catch (Exception exc)
                
                    throw new ServiceBusRelayException("\nServiceBusRelayProxyHelper.Initialize (sb://): An error ocurred with ServiceBusUri='" + serviceBusUri + "' - PolicyName='"+ policyName +"'.\nException Message: " + exc.Message, exc);
                

【问题讨论】:

docs.microsoft.com/en-us/azure/service-bus-relay/…中未列出此异常 【参考方案1】:

从今天开始,我遇到了同样的问题。您的代码没有问题,我必须与 MSFT 支持合作才能解决问题。他们不得不将我的服务总线命名空间移动到另一个节点,然后解决了这个问题。我建议通过 Azure 支持开具支持票。

【讨论】:

非常感谢!我们开了一张票,但我们还没有收到任何答复

以上是关于Microsoft.ServiceBus.InvalidRequestException:连接失败。缓存刷新超时的主要内容,如果未能解决你的问题,请参考以下文章