none
Connection was unexpectedly closed RRS feed

  • Question

  • I am developing a application that calls a WCF service from a for each statement.  It loops through several times with out issue; however, after that several times, it close the connection.  Does anyone have any thoughts of why this might be happening.  

    Robert Johnston

    Tuesday, April 9, 2013 3:34 PM

All replies

  • Various factors can cause this exception.

    Turn 'Tracing' by simply copying below into service configuration and view the log using WCF Trace viewer.

    Traces can be utilised for trouble shooting. Add below in WCF service configuration and open this trace file using WCF Trace Viewer.
    
    <system.diagnostics>
      <sources>
          <source name="System.ServiceModel.MessageLogging"
                   switchValue="Information, ActivityTracing, Error">
            <listeners>
                     <add name="messages"
                     type="System.Diagnostics.XmlWriterTraceListener"
                     initializeData="messages.svclog" />
              </listeners>
          </source>
        </sources>
    </system.diagnostics>
    
    
    
      <system.serviceModel>
      
        <diagnostics>
        <messageLogging
             logEntireMessage="true"
             logMalformedMessages="true"
             logMessagesAtServiceLevel="true"
             logMessagesAtTransportLevel="true"
             maxMessagesToLog="3000"
             maxSizeOfMessageToLog="2000"/>
      </diagnostics>
    

    Start Service Trace Viewer by using a command window to navigate to your WCF installation location (C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin), and then type SvcTraceViewer.exe.


    Apriori algorithm [association rule]

    Tuesday, April 9, 2013 7:52 PM
  • Can you post the code of for loop?

    ViBi

    Wednesday, April 10, 2013 2:59 AM
  • On 4/9/2013 11:34 AM, Bob Johnston wrote:

    I am developing a application that calls a WCF service from a for each statement.  It loops through several times with out issue; however, after that several times, it close the connection.  Does anyone have any thoughts of why this might be happening.

    Are you explicitly opening and closing the connection? I once worked on WCF solution where the client was in a slight loop, not really a loop, but it returned often enough that connections were left open, which caused concurrent connection problems.   The default is 5 concurrent WCF connections from the client with the service.

    Wednesday, April 10, 2013 3:18 AM