Link to home
Start Free TrialLog in
Avatar of WestcountryBusiness
WestcountryBusiness

asked on

WCF - Client connecting OK when LocalHost but Timeout when connecting remotely

I have a WCF service running with separate client software that connects to it.  All works fine in development when on one PC.  Also works fine in Live as long as client running on the same computer as WCF service but fails with timeout when connecting remotely.  I tried on two different 'live' environments and completely disabled the firewall (while testing) in both cases.

Here's the code that works locally:

 
Dim WithEvents CommsServerCallback As New AutomatedWeighbridgeInterventionCallback
Dim objClient As InterventionServiceReference.IInterventionService
Dim EndPointAddress As String
If Testing Then EndPointAddress = "http://localhost:8000/InterventionService/" Else EndPointAddress = "http://WCFServerPC:8000 InterventionService/"
Dim iCntx As New InstanceContext(CommsServerCallback)
Dim MyBinding As New WSDualHttpBinding
MyBinding.SendTimeout = New TimeSpan(0, 0, 30)
Dim MyEndPoint As New EndpointAddress(EndPointAddress)
Dim myChannelFactory As DuplexChannelFactory(Of IInterventionService) = New DuplexChannelFactory(Of IInterventionService)(iCntx, MyBinding, MyEndPoint)
objClient = myChannelFactory.CreateChannel()
 Try
      If Not objClient.SubscribeClient() Then Throw New Exception("Unable to Connect")
Catch ex As Exception
      Throw ex
End Try

Open in new window


When this runs on the same computer as the WCF service (name: WCFServerPC), both endpoints declared above work.  When this runs on a separate PC on the same network, it fails with a timeout at 'objClient.SubscribeClient()'.  Firewall is disabled.  What am I missing?  (e.g. is there some 'AllowRemoteConnections=False' setting in the app config somewhere or similar?)
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Dim objClient As InterventionServiceReference.IInterventionService
Dim EndPointAddress As String
If Testing Then EndPointAddress = "http://localhost:8000/InterventionService/" Else EndPointAddress = "http://WCFServerPC:8000 InterventionService/""http://WCFServerPC:8000/InterventionService/"
Avatar of WestcountryBusiness
WestcountryBusiness

ASKER

Hi David, thanks for your comment. Unfortunately that missing / was a typo when I copied the code to this post.  I tried to simplify it a little and changed the server host name for clarity (& got it wrong!).  In the live application, that line actually reads:
If LocalServer = "VICTORIA6" Then EndPointAddress = "http://Victoria6:8000/InterventionService/" Else EndPointAddress = "http://localhost:8000/InterventionService/"

Open in new window

Where Victoria6 is the actual host name of the PC.  Sorry for the error but the URL is correct so that's not the cause of this issue.
is port 8000 open on the firewall on Victoria6?
Sorry for delay in replying.  Yes the port is open, and I've specifically allowed the exe and I've tried with the firewall completely off.  My initial thoughts were a firewall issue but I think that rules it out (correct me if I'm wrong).

I'm struggling to debug this.  I've tried to telnet into the server on that port but get not connection, but then I'm not sure if I should.  Is there any testing I can do to track down whether its a communication issue (network, firewall etc.) or a configuration issues (something in the app.config or similar of the WCF server program)?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of WestcountryBusiness
WestcountryBusiness

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Solution found elsewhere on the Internet & posted here for reference