H W
H W

Reputation: 31

Azure Service Bus WCF Relay Timeout

I'm facing a problem with Azure Service Bus WCF Relay Service where the WCF client fails to get any result from the on-premise service that is behind a customer's firewall through WCF Relay. The WCF client is running on Azure as an Azure Cloud Service. The error message reported by the WCF client is:

System.ServiceModel.FaultException: 50200: None of the connected listeners accepted the connection within the allowed timeout. TrackingId:f11c6747-8628-44b3-9080-706e1a9122d5_G7, SystemTracker:xxxxxxxx.servicebus.windows.net:abc, Timestamp:2/21/2018 7:44:59 PM, Resource:sb://xxxxxxxx.servicebus.windows.net/abc

Server stack trace: 
   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 Client.RemoteService.Call(String parameter1, String parameter2)
   ...

From the on-premise WCF Service log file, there was no indication that the request ever made it.

I have the same WCF service running on different Azure WCF Relay Services behind other customers' firewalls. The others are working. This leads me to believe the problem is specific to the network environment behind this customer's firewall.

I searched for this type of problem with this specific error message but I couldn't find any. Similar dicussions are related to the 502 error code, but not 50200. Those discussions hinted around the proxy server setting. I have tried to set BasicHttpRelayBinding.UseDefaultWebProxy to false on the WCF Service. But that didn't solve the problem.

Here's the WCF Server side code:

ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Https;
var serviceAddress = ServiceBusEnvironment.CreateServiceUri("https", 
    "xxxxxxxx.servicebus.windows.net", "abc");

BasicHttpRelayBinding basicHttpRelayBinding = new BasicHttpRelayBinding();
basicHttpRelayBinding.UseDefaultWebProxy = false;

ServiceHost serverHost = new ServiceHost(typeof(MyService));
ServiceEndpoint serviceEndpoint = serverHost.AddServiceEndpoint(typeof(IMyService), 
    basicHttpRelayBinding, serviceAddress);
IEndpointBehavior endpointBehavior = new TransportClientEndpointBehavior
{
    TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(keyName, 
        keyValue)
};
serviceEndpoint.Behaviors.Add(endpointBehavior);

serverHost.Open();

Here's the WCF Client side code:

BasicHttpRelayBinding basicHttpRelayBinding = new BasicHttpRelayBinding();
basicHttpRelayBinding.UseDefaultWebProxy = false;
var cf = new ChannelFactory<T>(basicHttpRelayBinding,
           new EndpointAddress(ServiceBusEnvironment.CreateServiceUri(
               "https", "xxxxxxxx", "abc")));
IEndpointBehavior endpointBehavior = new TransportClientEndpointBehavior
{
    TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(keyName, 
        keyValue)
};
cf.Endpoint.Behaviors.Add(endpointBehavior);
var ch = cf.CreateChannel();
var response = ch.Call(parameter1, parameter2);

My questions are:

  1. Has anyone run into a problem like this?

  2. Given that I have no direct control over the network configuration behind the customer's firewall. What's the best way to diagnose problems like this? I can ask for help from the customer, but I need to tell them what to look for.

Upvotes: 3

Views: 903

Answers (0)

Related Questions