Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2016-08-12
6
41 Views
Last Modified: 2016-08-27
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?)
0
Comment
Question by:WestcountryBusiness
  • 4
  • 2
6 Comments
 
LVL 80

Expert Comment

by:David Johnson, CD, MVP
ID: 41755214
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/"
0
 
LVL 1

Author Comment

by:WestcountryBusiness
ID: 41756127
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.
0
 
LVL 80

Expert Comment

by:David Johnson, CD, MVP
ID: 41756235
is port 8000 open on the firewall on Victoria6?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 1

Author Comment

by:WestcountryBusiness
ID: 41759034
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
0
 
LVL 1

Accepted Solution

by:
WestcountryBusiness earned 0 total points
ID: 41765071
OK, found the solution.  Basically it was the use of wsDualHttpBinding as that opens a return port to the client so requiring firewall changes to the client as well as the server.  The best fix was to use net TCP binding.

Thanks to this excellent artical that finally offered the solution:
http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b891610a-6b78-4b54-b9a6-4ec81c82b7c0.aspx
0
 
LVL 1

Author Closing Comment

by:WestcountryBusiness
ID: 41772824
Solution found elsewhere on the Internet & posted here for reference
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question