none
TCP Error Code 10060 on client when service is self-hosted on a remote PC

    Question

  • I'm getting an error when a client application calls a self-hosted console service running on a remote PC and using BasicHttpBinding.   Thinking the problem was in my code, I backtracked to using a simple SDK example, the Basic\Service\Hosting\SelfHost example, but use basicHttpBinding instead of wsHttpBinding.  The sample works fine when both client and service are on the same PC, but fails with the error below otherwise:

    System.ServiceModel.EndpointNotFoundException:

    Could not connect to http://10.0.0.44:8000/servicemodelsamples/service.
    TCP error code 10060: A connection attempt failed because the connected party
    did not properly respond after a period of time, or established connection
    failed because connected host has failed to respond. 

    ---> System.Net.WebException: Unable to connect to the remote server
    ---> System.Net.Sockets.SocketException: A connection attempt failed because
    the connected party did not properly respond after a period of time, or
    established connection failed because connected host has failed to respond\r\n  
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\r\n  
    at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)\r\n  
    at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)\r\n  
    --- End of inner exception stack trace ---\r\n  
    at System.Net.HttpWebRequest.GetRequestStream()\r\n  
    at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()\r\n  
    --- End of inner exception stack trace
    ---\r\n\r\n
    Server stack trace: \r\n  
    at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()\r\n  
    at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)\r\n  
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)\r\n  
    at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)\r\n  
    at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)\r\n  
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n  
    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)\r\n  
    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n  
    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\n
    Exception rethrown at [0]: \r\n  
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n  
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n  
    at Microsoft.ServiceModel.Samples.ICalculator.Add(Double n1, Double n2)\r\n  
    at Microsoft.ServiceModel.Samples.CalculatorClient.Add(Double n1, Double n2)
    in C:\\ideablade\\WCF\\sdk samples\\Basic\\Service\\Hosting\\SelfHost\\CS\\client\\generatedClient.cs:line 70\r\n  
    at Microsoft.ServiceModel.Samples.Client.Docalcs(String config)
    in C:\\IdeaBlade\\wcf\\sdk samples\\Basic\\Service\\Hosting\\SelfHost\\CS\\client\\client.cs:line 39

    I've tried using the machine name instead of the IP address, but with the same results.  I've also tried bumping up the open and send timeout values.  The service is definitely running and exposing the correct endpoint, since local clients can connect.  The two machines are not in the same domain, nor in the same workgroup, but each can ping the other.  Hosting the service under IIS does work, but is not an option in this case.

    How do I fix this? 

    Thursday, February 01, 2007 12:48 AM

Answers

  • Found the problem.  We thought that the port was open since the program was listed as an exception in Windows Firewall.  This had been sufficient for the .NET Remoting version of the service.  To get this working we needed to explicitly open the port.
    Friday, February 02, 2007 1:16 AM

All replies

  • Hello,

    What happens if you try to browse the metadata (i.e., WSDL) of the service inside a browser from the client machine?  To do this, you'll need to enable metadata publishing on the service using the HTTP GET mechanism (can do this via code or config -- please refer to samples and/or MSDN documentation on how to do this) and then open a browser on the client machine and go to the following URL: http://10.0.0.44:8000/servicemodelsamples/service?wsdl (i.e., the base address of your service plus ?wsdl).

    Thanks.

    Thursday, February 01, 2007 12:59 AM
  • I get a page error containing the message "cannot find server or DNS error".
    Thursday, February 01, 2007 2:58 AM
  • Found the problem.  We thought that the port was open since the program was listed as an exception in Windows Firewall.  This had been sufficient for the .NET Remoting version of the service.  To get this working we needed to explicitly open the port.
    Friday, February 02, 2007 1:16 AM
  • Yes, this points out that the issue is not related to WCF but rather a general network setup issue.

    Thanks.

    Friday, February 02, 2007 8:21 PM
  • Hi

    I'm new in WCF programming and i got the same error.

    Did you resolve your problem about this error? If so please help me to fixe this bug.

    thanks.

     

    • Proposed as answer by stonesina Wednesday, June 06, 2012 3:48 PM
    Monday, November 12, 2007 11:23 AM
  • Can you help to the newbie? Run into the same issue (PC's are in the same domain though). Can you tell more how to open the port explicitly?

    Tuesday, July 29, 2008 9:49 PM
  •  

    Hi,

    Can you please tell me that how to explicitly open the port in .net.

    I am trying to access the Live Search weservice while doing this ,

    I am getting the error messeage "Could not connect to http://soap.search.live.com/webservices.asmx. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 203.199.74.16:80."

     

     

    Saturday, August 02, 2008 9:34 AM
  •  Hi,

    I have an App that when it is running on VS ( through nUnit Test cases ) it can access the webservice and everything is fine, but when I install the same App as Windows Service ( installutil ) I got this same error,

    Someone can help me too?
    Tks.

    Wednesday, March 11, 2009 4:28 PM
  • I added my server application as an exception in WindowsFirewall and am able to connect to the server application from clients without getting the 10060 TCP error.
    Tuesday, May 26, 2009 8:46 AM