locked
WCF: Connection closed unexpectedly RRS feed

  • Question

  •  

    I saw other posts on this error, and set up server side trace, hoping it would pin the cause of the error more precisely, but my results are below.

     

    Our webservice uses LINQ to return a LIST of LINQ objects.  It works okay with 82 records and below, and always gives the "connection closed unexpectedly" with 90 and above.  (I just change the Select Top x in the stored procedure).

     

    I have set all the timeouts to 20:00 (and it actually is running about 3 minutes of wall time before it gets the error (my virtual machine seems to be slower than other people who have been testing).

     

    Originally was getting the error in a BizTalk orchestration, but not have isolated same error in a Console Test program calling the same WebService.

     

    Any ideas?

     

    Thanks,
    Neal Walters

    http://BizTalk-Training.com

     

     

    <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131075</EventID><Type>3</Type><SubType Name="Error">0</SubType><Level>2</Level><TimeCreated SystemTime="2008-09-08T16:46:50.2812500Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{3591b80c-185c-4c57-a725-b3aeb36f4468}" /><Execution ProcessName="TMAC.ESBWeb.WebServices.TDSWEBService.ConsoleTest.vshost" ProcessID="4176" ThreadID="10" /><Channel /><Computer>Dev-XP-BZWRK-01</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"><TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier><Description>Throwing an exception.</Description><AppDomain>TMAC.ESBWeb.WebServices.TDSWEBService.ConsoleTest.vshost.exe</AppDomain><Exception><ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>

    <Message>The underlying connection was closed: The connection was closed unexpectedly.</Message>

    <StackTrace>   at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)
       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)
       at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp;amp; msgData, Int32 type)
       at TMAC.ESBWeb.WebServices.TDSWEBService.ConsoleTest.TDSWEBServiceReference.ITDSWEBService.QueryLoans(String typeOfRequest)
       at TMAC.ESBWeb.WebServices.TDSWEBService.ConsoleTest.TDSWEBServiceReference.TDSWEBServiceClient.QueryLoans(String typeOfRequest)
       at TMAC.ESBWeb.WebServices.TDSWEBService.ConsoleTest.Program.QueryLoansTest()
       at TMAC.ESBWeb.WebServices.TDSWEBService.ConsoleTest.Program.Main(String[] args)
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
    </StackTrace><ExceptionString>System.ServiceModel.CommunicationException: The underlying connection was closed:
    The connection was closed unexpectedly. ---&amp;gt; System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       --- End of inner exception stack trace ---</ExceptionString><InnerException><ExceptionType>System.Net.WebException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The underlying connection was closed: The connection was closed unexpectedly.</Message><StackTrace>   at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)</StackTrace><ExceptionString>System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
    </ExceptionString></InnerException></Exception></TraceRecord>
    </DataItem></TraceData></ApplicationData></E2ETraceEvent>

     

    Monday, September 8, 2008 4:58 PM

Answers

All replies

  • Duh - I was looking at the clien trace, not the server trace.

    The server trace does give a little information, but I'm still not sure how to interpret it.

    There seem to be three of the messages below (maybe it tries 3 times then quits?).

     

     

    Message:

    There was an error while trying to serialize parameter http://TMAC.ESBWeb.WebServices.TDSWEBService:QueryLoansResult. The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. '.  Please see InnerException for more details.

     

    This should be a help - I will follow-up on this.

     

    Thanks,
    Neal Walters

    Monday, September 8, 2008 5:10 PM
  • Monday, September 8, 2008 5:14 PM
  • Ya we had the same issue here is the fix we had

    just add a maxIntemsInObjectGraph to the wcf service behavior in your web.config

    <

     

    behavior name="someServiceBehavior">
         <
    serviceMetadata httpGetEnabled="true" />
         <
    serviceDebug includeExceptionDetailInFaults="true" />
         <
    dataContractSerializer maxItemsInObjectGraph="6553600" />
    </
    behavior>


    jacob dek
    Saturday, July 11, 2009 9:01 PM