none
WCF - Getting Timeout Exception After 5 Mins Continuously Processing RRS feed

  • Question

  • Hi All,

    I am working on WCF project where there is client and service communication only once. I am getting exception after 5 mins when we are executing service side code.

    Please find below web.config file 

     <binding name="TestManagementBinding" maxBufferPoolSize="2147483647" closeTimeout="05:01:00"     openTimeout="05:01:00"
              receiveTimeout="05:01:00" sendTimeout="05:01:00"
              maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
              <readerQuotas maxStringContentLength="2147483647" />
              <security mode="None">
                <transport clientCredentialType="None" />
              </security>
            </binding>

    Please find exception we are getting after 5 mins - 

    Exception:System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to "CUSTOM URL". This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
       at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
       at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       --- End of inner exception stack trace ---
       at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
       at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
       at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
       at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
       at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
       --- End of inner exception stack trace ---
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       --- End of inner exception stack trace ---

    Server stack trace: 
       at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Please help.

    Thanks.

    Friday, December 11, 2015 2:23 PM

Answers

  • Hi sud,

    Maybe you can try add the following node in your server web.config file.

    <system.net>
        <connectionManagement>
          <add maxconnection = "200" address ="*" />
        </connectionManagement>
      </system.net>

    For more information, please refer to the  following link:

    1.WCF timeout exception detailed investigation

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Thursday, December 24, 2015 9:54 AM
    Moderator

All replies

  • Hi Sud Gujar,

    For this case, I am not sure where the issue happened. So, in my opinion, you can try set

    the tracing on the server by adding the following to your web.config:

    <system.diagnostics>
      <sources>
        <source name="System.ServiceModel"
                switchValue="Information, ActivityTracing"
                propagateActivity="true">
          <listeners>
            <add name="traceListener"
                type="System.Diagnostics.XmlWriterTraceListener"
                initializeData="c:\logs\Traces.svclog"  />
          </listeners>
        </source>
      </sources>
    </system.diagnostics>

    Then, you will get the more information about this issue.

    And as far as I know, when we set the timeout properties, we need set the same value in

    client also.

    So, I suggest you can check the client app.config file whether it has set. 

    I hope that will be helpful to you.

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    Tuesday, December 15, 2015 6:29 AM
    Moderator
  • Hi,

    Thanks for your suggestion.

    For the time being, we can not add log file because web.config file is global for various users. If it is not present on users machine, will it throw exception ? The application is running widely and it may affected various users globally.

    Do I missed any property in web.config ? or Can I have any work around ?

    Thanks.

    Tuesday, December 22, 2015 3:25 PM
  • Hi sud,

    Maybe you can try add the following node in your server web.config file.

    <system.net>
        <connectionManagement>
          <add maxconnection = "200" address ="*" />
        </connectionManagement>
      </system.net>

    For more information, please refer to the  following link:

    1.WCF timeout exception detailed investigation

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Thursday, December 24, 2015 9:54 AM
    Moderator