Sunday, January 24, 2010

WCF binding and Proxy

I had many applications consuming my WCF services since long time. It was all fine even in production. Recently we had a windows service which had to use the same service. And we did refer the WCF as usual and deployed the service on one of the test box. The service started breaking all of a sudden with below error.

System.ServiceModel.EndpointNotFoundException: Could not connect to http://[IP]/Service.svc. 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 [Different IP]:3128. ---> 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 [Different IP]:3128
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream()
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
--- End of inner exception stack trace ---

Server stack trace:
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)

I had a WCF hosted with http://[IP]/Service.svc. When I try connecting to this service it was throwing error “TCP error code 10060”. And the error message used to show different IP which is not the actual host where the WCF is hosted. I have changed that as [Different IP] and it was using some other port. I did verify the proxy settings and the proxy was some other IP. I was not sure from where it was picking the proxy ip and trying to connect.

But as a temporary solution I made the config change not to use default proxy by setting useDefaultWebProxy="false". This setting solved the error.

<binding name="WSHttpBinding_IService" closetimeout="00:10:00" opentimeout="00:03:00" receivetimeout="00:10:00" sendtimeout="00:03:00" bypassproxyonlocal="false" transactionflow="false" hostnamecomparisonmode="StrongWildcard" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" messageencoding="Text" textencoding="utf-8" usedefaultwebproxy="false" allowcookies="false">
<readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647">
<reliablesession enabled="false" ordered="true" inactivitytimeout="00:10:00">
<security mode="Message">
<transport realm="" clientcredentialtype="Windows" proxycredentialtype="None">
<message clientcredentialtype="Windows" negotiateservicecredential="true" algorithmsuite="Default" establishsecuritycontext="true">
</security>

</binding>





No comments:

Post a Comment