none
System.Net.Sockets.SocketException occurs during communication between two WCF windows services RRS feed

  • Question

  • Two windows services Client and Server are installed, when client tries to call a method in the Server services this exception is thrown,

    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

    Client exception stack trace is as follows if it stands of any help

       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
       at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
       at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
       at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
       at System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()
       at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
       at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
       at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
       at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

    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)

    Could not narrow down to the exact problem, any thoughts??

    Thursday, June 27, 2013 5:16 AM

Answers

  • The problem occurred because the server had two NIC cards and just to make us go mad the mean client service was deliberately pointing to the inactive NIC card, this can be resolved by either disabling one of the card or making this change in the server WCF service.

    <channel ref="tcp" port="8675" bindTo = “IPAddress”>

              <serverProviders>

                <formatter ref="binary" typeFilterLevel="Full"/>

              </serverProviders>

    </channel>

    Thursday, June 27, 2013 10:18 AM

All replies

  • The problem occurred because the server had two NIC cards and just to make us go mad the mean client service was deliberately pointing to the inactive NIC card, this can be resolved by either disabling one of the card or making this change in the server WCF service.

    <channel ref="tcp" port="8675" bindTo = “IPAddress”>

              <serverProviders>

                <formatter ref="binary" typeFilterLevel="Full"/>

              </serverProviders>

    </channel>

    Thursday, June 27, 2013 10:18 AM
  • Hi,

    I am very glad that you have solved your problem by yourself. And it will help others who meet the same question as you.

    If you have any other problem, welcome to post it in the WCF Forums.

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 28, 2013 2:56 AM
    Moderator