We have a system where a client flash application is calling an asmx based Search web service which in turn calls a wcf service hosted in a windows service using NetTcpBinding. This is working fine when the no. of search results are small. But when the Search results are going large, in the range of 2000 records, we are getting an exception in the asmx service where it calls the wcf:
`The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.`
In order to troubleshoot the error, we enabled service tracing and found that the error reported is:
`The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:00'.`
We have increased the timeout values in both server and client configs and also increased the maxItemsInObjectGraph value. There are no errors happening at the wcf call as we can debug it and the observed behavior is, when the wcf call returns, the code in the asmx service is hitting the exception block and reporting the above error.
Server Side Config:
<system.serviceModel>
<services>
<service name="***.SearchController" behaviorConfiguration="serviceBehavior">
<endpoint address="net.tcp://localhost:8228/SearchController" binding="netTcpBinding" contract="***.ISearch" name="SearchController" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceDebug includeExceptionDetailInFaults="True" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="LargeMessageBinding"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxConnections="2147483647"
maxReceivedMessageSize="2147483647"
portSharingEnabled="false"
transactionFlow="false"
listenBacklog="2147483647"
closeTimeout="infinite"
openTimeout="infinite"
receiveTimeout="infinite"
sendTimeout="infinite">
<security mode="None">
<message clientCredentialType="None"/>
<transport protectionLevel="None" clientCredentialType="None"/>
</security>
<reliableSession enabled="false"/>
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
<diagnostics wmiProviderEnabled="true">
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
/>
</diagnostics>
<client></client>
Client(axms) Side Config:
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:8228/SearchController" binding="netTcpBinding" behaviorConfiguration="endpointBehavior" contract="***.ISearch" name="NewSearch"/>
</client>
<bindings>
<netTcpBinding>
<binding name="LargeMessageBinding"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxConnections="2147483647"
maxReceivedMessageSize="2147483647"
portSharingEnabled="false"
transactionFlow="false"
listenBacklog="2147483647"
closeTimeout="infinite"
openTimeout="infinite"
receiveTimeout="infinite"
sendTimeout="infinite">
<security mode="None">
<message clientCredentialType="None"/>
<transport protectionLevel="None" clientCredentialType="None"/>
</security>
<reliableSession enabled="false"/>
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="endpointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
The code using which the wcf gets called from the asmx service:
List<***.SearchResult> results;
using (var searchFactory = new ChannelFactory<***.ISearch>("NewSearch"))
{
Legacy.ISearch searchProxy = searchFactory.CreateChannel();
results = searchProxy.Search(searchOption);
}
This call is reporting the exception.
We are not sure why we are getting a timeout issue even after increasing the thresholds in the config. Could it be that the service is not picking up our binding config and using some default config values and hence throwing the error. Not sure what is the way to validate if the service has actually picked up our config at runtime. Need help in troubleshooting this issue.
you must use binding in your application, but you declare it only, use bindingConfiguration
property
<endpoint address="net.tcp://localhost:8228/SearchController" binding="netTcpBinding" contract="***.ISearch" name="SearchController" bindingConfiguration="LargeMessageBinding" />
and bindingConfiguration="LargeMessageBinding"
to client config too