Wednesday, June 17, 2009

WCF Error : TCP Error Code 10061

Scenario:
While trying to connect to WCF endpoint you got following error :
Error : Could not connect to net.tcp://servername:8080/ServiceName. The connection attempt lasted for a time span of 00:00:01.*. TCP error code 10061: No connection could be made because the target machine actively refused it 198.0.0.1:8080.

Solution:
-- Try to connect to WCF endpoint by adding a service reference using Visual Studio
-- Make sure service host is running.
-- Make sure the Configuration is same on both side ( server and client )
-- Try turning off security mode = None (case sensitive) as shown below
-- In case there is no trust between domain , you might need to set firewall exception to open the port for communication

Code:

<bindings>
<netTcpBinding>
<binding name="MyService.Binding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false" transferMode="Buffered" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" listenBacklog="10" maxConnections="10">
<readerQuotas maxDepth="65536" maxStringContentLength="65536" maxArrayLength="65536" maxBytesPerRead="65536" maxNameTableCharCount="65536" />
<security mode ="None" />
</binding>
</netTcpBinding>
</bindings>

Follow me on Twitter

4 comments:

Anonymous,  February 26, 2011 at 10:59 AM  

thanks for the suggestions
will try them out

Diya June 23, 2011 at 4:22 AM  

has anyone try with Windows7 i am unable resolve the error with windows

Anonymous,  June 23, 2011 at 4:24 AM  

Sandeep did you try with Windows7 i am unable to remove ths error, please help me

Sandeep June 23, 2011 at 5:30 AM  

Hi Diya

I don't see any reason that this solution will not work on Win 7.

I will try it over weekend

Sandeep