Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2016-08-12
6
Medium Priority
?
92 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
[X]
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
  • 4
  • 2
6 Comments
 
LVL 83

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 83

Expert Comment

by:David Johnson, CD, MVP
ID: 41756235
is port 8000 open on the firewall on Victoria6?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

618 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