WCF Timeout Exception on IIS hosting

782 views Asked by At

Thanks in Adavance. I am getting timeout exception after 5 minutes eventhough all timeouts are set to 10 minutes. Wcf is hosted in IIS. Client config is as below '

<netTcpBinding>
<binding name="TcpAuthBinding" closeTimeout="00:00:05" openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" algorithmSuite="Default" />
</security>
</binding>
</netTcpBinding>

'

Server Config is as below

  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
    <serviceActivations>
    <add service="ReportingService" relativeAddress ="ReportingService.svc" factory="Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, Castle.Facilities.WcfIntegration"/>
    </serviceActivations>
    </serviceHostingEnvironment>
    <behaviors>
    <serviceBehaviors>
    <behavior name="customBehavior">
      <serviceMetadata httpGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
      <serviceTimeouts transactionTimeout="00:10:00" />
      <exceptionMarshalling/>
    </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
    <behavior name="customEndpointBehavior">
      <protobuf maxItemsInObjectGraph="2147483646" />
    </behavior>
    </endpointBehaviors>
    </behaviors>
    <extensions>
    <services>
    <service name="Sample.ReportingService" behaviorConfiguration="customBehavior">
    <endpoint binding="customBinding" bindingConfiguration="CustomNetTcpBinding" behaviorConfiguration="customEndpointBehavior" contract="Sample.IReportingService"  />
    </service>
    </services>
    <bindings>
    <customBinding>
    <binding name="CustomNetTcpBinding" closeTimeout="00:00:05" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
      <transactionFlow/>
      <gZipMessageEncoding enableCompression="true" innerMessageEncoding="textMessageEncoding">
        <readerQuotas maxDepth="999999999" maxStringContentLength="999999999" maxArrayLength="999999999" maxBytesPerRead="999999999" maxNameTableCharCount="999999999" />
      </gZipMessageEncoding>
      <windowsStreamSecurity/>
      <tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
    </customBinding>
    </bindings>
    </system.serviceModel>'

This is intermittent issue. In service I am fetching data from database server. Exception is as below

'System.ServiceModel.CommunicationException: 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:09:59.9970000'. ---> System.IO.IOException: The read operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: 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:09:59.9970000'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
   --- End of inner exception stack trace ---
   at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
   at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
   at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.Security.NegotiateStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.NegotiateStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   --- End of inner exception stack trace ---
   at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
   --- End of inner exception stack trace ---
   at Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.<>c__DisplayClass1.<PerformInvocation>b__0(WcfInvocation wcfInvocation)
   at Castle.Facilities.WcfIntegration.WcfInvocation.Proceed()
   at Castle.Facilities.WcfIntegration.RepairChannelPolicy.Apply(WcfInvocation wcfInvocation)
   at Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.PerformInvocation(IInvocation invocation, IWcfChannelHolder channelHolder, Action`1 action)
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.IWcfChannelHolderProxy_3.ReportRequest(ReportDefinitionContract rpt)
   at System.Threading.Tasks.Task`1.InvokeFuture(Object futureAsObj)
   at System.Threading.Tasks.Task.Execute()'
0

There are 0 answers