Azure Service Bus Relay偶尔发生FaultException

Sli*_*SFT 6 wcf azure azure-sdk-.net basichttprelaybinding azure-servicebusrelay

我们无法确定为什么Azure BasicHttpRelay偶尔会抛出FaultException没有任何细节.我们已启用WCF诊断跟踪,但可用的堆栈跟踪信息仍然相同.似乎WCF客户端通道在短时间内失败,然后很快返回.

我们确实缓存了WCF频道(例如CreateChannel),但这是我们第一次遇到这种奇怪的行为.我们有其他Azure Service Bus中继解决方案可以正常使用这种方法.

错误信息:

处理请求时遇到错误.

堆栈跟踪:

   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at [our WCF method]...

FaultException - FaultCode详细信息:

名称: ServerErrorFault
命名空间: http ://schemas.microsoft.com/netservices/2009/05/servicebus/relay
IsPredefinedFault: false
IsReceiverFault: false
IsSenderFault: false

肥皂消息

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header />
  <s:Body>
    <s:Fault>
      <faultcode xmlns:a="http://schemas.microsoft.com/netservices/2009/05/servicebus/relay">a:ServerErrorFault</faultcode>
      <faultstring xml:lang="en-US">There was an error encountered while processing the request.</faultstring>
      <detail>
        <ServerErrorFault xmlns="http://schemas.microsoft.com/netservices/2009/05/servicebus/relay" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" />
      </detail>
    </s:Fault>
  </s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)

通过调试,我们可以看到服务器正确响应消息请求(通过IDispatchMessageInspector),但客户端无法正确处理响应(IClientMessageInspector报告错误).在客户端通道似乎纠正自身之后,后续中继请求将成功.这些故障似乎是间歇性的,而不是负载驱动的.我们从未在Azure中继外部看到这些FaultException错误basicHttpBinding.

有没有人有什么建议?我们使用的是Azure SDK 1.8.

我尝试使用共享密钥配置新的Service Bus Relay命名空间owner,但仍然看到相同的结果.

Sli*_*SFT 1

在联系微软后,这个问题被证明是微软中继或 SDK 的错误,特别是在使用Http 连接模式时。此时,唯一的解决方法是确保打开适当的传出 TCP 端口,以确保与 Azure 中继的可靠连接。

允许传出 TCP 端口:9350 - 9354

MS 告诉我们,他们仍在努力解决根本原因。希望这个解决方法能够帮助其他人。我们的公司防火墙阻止了这些 TCP 端口,这迫使所有通信都通过端口 80 进行,这必然会触发此问题。积极的一点是,打开这些端口可以在启动侦听器时更快地连接到中继(AutoDetect不必每次都检查 TCP 端口可用性)。