locked
WCF connections are aborted incorrectly RRS feed

  • Question

  • I have a Windows application that uses WCF service. It has some WCF service calls, and ClientBase.Close() method is always called afterwards. When I close the application, I do not get any errors in it in VS2010 (I've turned on all exceptions in the debugger and attached my compiler to everything I could). But I do get an exception on the WCF service! Below is it's message:

    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 (some big number goes here).

    And the inner exception is:

    An existing connection was forcibly closed by the remote host.

    But how could this happen to my code? I am closing all connections, and no WCF service calls are running asynchroniously when I am closing my app. What can I do to find the reason of this erroneous behaviour?

    Thursday, May 3, 2012 5:22 PM

Answers

  • Enable tracing in your service and also add some logging in the operations in your wcf service. 

    It will tell you whats going on. 

    May be you need to set out the open, close, send, receive timeout properties in your wcf binding configuration. 

    If your operation is taking longer that what you configured in the timeout, WCF will shutdown the channel and throw socket exception. 

    If you are sending and receiving large data also set the following properties to a large int value in binding 

    maxReceivedMessageSize

    maxbuffersize

    maxbufferpoolsize

    You may also need to set the readerquotas

    <readerQuotas 
        maxArrayLength="Integer"
            maxBytesPerRead="Integer"
            maxDepth="Integer"
            maxNameTableCharCount="Integer"
        maxStringContentLength=="Integer" />


    Tanvir Huda Application Architect/Consultant http://thetechnocrate.wordpress.com/

    Friday, May 4, 2012 8:39 AM

All replies

  • You are making calls to a Typed-Client. Are you making the calls
    correctly as in the example on how to make calls to a Typed-Client with
    try/catch with client.Abort() and client.Close().
     
     
     
    Thursday, May 3, 2012 7:21 PM
  • Enable tracing in your service and also add some logging in the operations in your wcf service. 

    It will tell you whats going on. 

    May be you need to set out the open, close, send, receive timeout properties in your wcf binding configuration. 

    If your operation is taking longer that what you configured in the timeout, WCF will shutdown the channel and throw socket exception. 

    If you are sending and receiving large data also set the following properties to a large int value in binding 

    maxReceivedMessageSize

    maxbuffersize

    maxbufferpoolsize

    You may also need to set the readerquotas

    <readerQuotas 
        maxArrayLength="Integer"
            maxBytesPerRead="Integer"
            maxDepth="Integer"
            maxNameTableCharCount="Integer"
        maxStringContentLength=="Integer" />


    Tanvir Huda Application Architect/Consultant http://thetechnocrate.wordpress.com/

    Friday, May 4, 2012 8:39 AM