Question

I don't have a problem running the service call on my dev machine that responds with a huge message, however when I release the client proxy it doesn't work on our server (the client is part of a service).

Is there an IIS setting or something that needs to be configured to allow for larger responses?

When I view with Fiddler it mentions something about a content length mismatch.

.Net Error is:

There is a problem with the XML that was received from the network. See inner exception for more details. System.ServiceModel.ProtocolException: There is a problem with the XML that was received from the network. See inner exception for more details. --->

System.Xml.XmlException: Unexpected end of file. Following elements are not closed: Body, Envelope. Line 1, position 2609.
       at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
       at System.Xml.XmlExceptionHelper.ThrowUnexpectedEndOfFile(XmlDictionaryReader reader)
       at System.Xml.XmlUTF8TextReader.ReadAttributes()
       at System.Xml.XmlUTF8TextReader.ReadStartElement()
       at System.Xml.XmlUTF8TextReader.Read()
       at System.Xml.XmlBaseReader.ReadEndElement()
       at System.ServiceModel.Channels.MessageHeaders.Init(MessageVersion version, XmlDictionaryReader reader, IBufferedMessageData bufferedMessageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
       at System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
       at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
       at System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)
       --- End of inner exception stack trace ---

My binding is set up as follows:

Dim myBinding As New CustomBinding
myBinding.Elements.Add(GetAsyBindingElement())

'Encoding Binding Element
Dim textMsgEncoder As New TextMessageEncodingBindingElement(MessageVersion.Soap11, System.Text.Encoding.UTF8)
textMsgEncoder.ReaderQuotas.MaxDepth = Integer.MaxValue '2147483647
textMsgEncoder.ReaderQuotas.MaxStringContentLength = Integer.MaxValue '2147483647
textMsgEncoder.ReaderQuotas.MaxArrayLength = Integer.MaxValue '2147483647
textMsgEncoder.ReaderQuotas.MaxBytesPerRead = Integer.MaxValue '2147483647
textMsgEncoder.ReaderQuotas.MaxNameTableCharCount = Integer.MaxValue '2147483647

myBinding.Elements.Add(textMsgEncoder)

Dim httpBindingElement As New HttpTransportBindingElement
httpBindingElement.MaxBufferSize = Integer.MaxValue
httpBindingElement.MaxReceivedMessageSize = Integer.MaxValue
httpBindingElement.MaxBufferPoolSize = Integer.MaxValue
myBinding.Elements.Add(httpBindingElement)

Return myBinding

I captured the WCF Errors using a listener as suggested here

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Transfer">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.0992190Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" RelatedActivityID="{69598e69-7f36-498c-a6d4-e53cfccf7a31}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131085</EventID><Type>3</Type><SubType Name="Start">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.0992190Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{69598e69-7f36-498c-a6d4-e53cfccf7a31}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Start"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Construct ChannelFactory. Contract type: 'ServiceClient.wcfServiceProxy.Service'.</ActivityName><ActivityType>Construct</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Transfer">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1148440Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{69598e69-7f36-498c-a6d4-e53cfccf7a31}" RelatedActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131085</EventID><Type>3</Type><SubType Name="Stop">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1148440Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{69598e69-7f36-498c-a6d4-e53cfccf7a31}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Stop"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Construct ChannelFactory. Contract type: 'ServiceClient.wcfServiceProxy.Service'.</ActivityName><ActivityType>Construct</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Transfer">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1148440Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" RelatedActivityID="{25a71701-e229-4517-b70c-f7d913aacda9}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131085</EventID><Type>3</Type><SubType Name="Start">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1148440Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{25a71701-e229-4517-b70c-f7d913aacda9}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Start"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Open ClientBase. Contract type: 'ServiceClient.wcfServiceProxy.Service'.</ActivityName><ActivityType>Open</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Transfer">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1304690Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{25a71701-e229-4517-b70c-f7d913aacda9}" RelatedActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131085</EventID><Type>3</Type><SubType Name="Stop">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1304690Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{25a71701-e229-4517-b70c-f7d913aacda9}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Stop"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Open ClientBase. Contract type: 'ServiceClient.wcfServiceProxy.Service'.</ActivityName><ActivityType>Open</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Transfer">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1304690Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" RelatedActivityID="{faa212a6-54bc-4d7a-a20b-a045ac093ea2}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131085</EventID><Type>3</Type><SubType Name="Start">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1304690Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{faa212a6-54bc-4d7a-a20b-a045ac093ea2}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Start"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Process action ''.</ActivityName><ActivityType>ProcessAction</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>458781</EventID><Type>3</Type><SubType Name="Information">0</SubType><Level>8</Level><TimeCreated SystemTime="2014-01-03T18:14:17.1304690Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{faa212a6-54bc-4d7a-a20b-a045ac093ea2}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Security.SecurityBindingOutgoingMessageSecured.aspx</TraceIdentifier><Description>The security protocol secured the outgoing message.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/SecurityProtocolTraceRecord"><SecurityProtocol>System.ServiceModel.Security.TransportSecurityProtocol</SecurityProtocol></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>262163</EventID><Type>3</Type><SubType Name="Information">0</SubType><Level>8</Level><TimeCreated SystemTime="2014-01-03T18:14:17.5523440Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{faa212a6-54bc-4d7a-a20b-a045ac093ea2}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Channels.MessageSent.aspx</TraceIdentifier><Description>Sent a message over a channel.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><Source>System.ServiceModel.Channels.HttpOutput+WebRequestHttpOutput/41973342</Source><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTraceRecord"><MessageProperties><Encoder>text/xml; charset=utf-8</Encoder><AllowOutputBatching>False</AllowOutputBatching><Via>http://www..ford.com/services//1.0</Via></MessageProperties><MessageHeaders><ActivityId CorrelationId="12823e4b-228f-420b-bf56-3f0e051984b6" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">faa212a6-54bc-4d7a-a20b-a045ac093ea2</ActivityId></MessageHeaders></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><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="2014-01-03T18:14:17.8492190Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{faa212a6-54bc-4d7a-a20b-a045ac093ea2}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier><Description>Throwing an exception.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><Exception><ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>There is a problem with the XML that was received from the network. See inner exception for more details.</Message><StackTrace>   at System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)
   at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
   at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception&amp;amp; requestException)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.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 ServiceClient.wcfServiceProxy.Service.list(listRequest request)
   at ServiceClient.wcfServiceProxy.ServiceClient.wcfServiceProxy_Service_list(listRequest request)
   at ServiceClient.Service.ServiceClient.GetData(Service clientProxy, Request request)
   at ServiceClient.Service.ServiceClient.Query(Request request)
   at ServiceClient.Facades.Facade.Query(Request request)
   at ServiceMenuIntegrationService.CatalogueIntegrationService.GetInformation(Request request)
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&amp;amp; sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
   at System.Web.Services.Protocols.WebServiceHandler.Invoke()
   at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
   at System.Web.Services.Protocols.SyncSessionlessHandler.ProcessRequest(HttpContext context)
   at System.Web.Script.Services.ScriptHandlerFactory.HandlerWrapper.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp;amp; completedSynchronously)
   at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
   at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus&amp;amp; notificationStatus)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
</StackTrace><ExceptionString>System.ServiceModel.ProtocolException: There is a problem with the XML that was received from the network. See inner exception for more details. ---&amp;gt; System.Xml.XmlException: Unexpected end of file. Following elements are not closed: Body, Envelope. Line 1, position 2793.
   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowUnexpectedEndOfFile(XmlDictionaryReader reader)
   at System.Xml.XmlUTF8TextReader.ReadAttributes()
   at System.Xml.XmlUTF8TextReader.ReadStartElement()
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlBaseReader.ReadEndElement()
   at System.ServiceModel.Channels.MessageHeaders.Init(MessageVersion version, XmlDictionaryReader reader, IBufferedMessageData bufferedMessageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
   at System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
   at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
   at System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)
   --- End of inner exception stack trace ---</ExceptionString><InnerException><ExceptionType>System.Xml.XmlException, System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Unexpected end of file. Following elements are not closed: Body, Envelope. Line 1, position 2793.</Message><StackTrace>   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowUnexpectedEndOfFile(XmlDictionaryReader reader)
   at System.Xml.XmlUTF8TextReader.ReadAttributes()
   at System.Xml.XmlUTF8TextReader.ReadStartElement()
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlBaseReader.ReadEndElement()
   at System.ServiceModel.Channels.MessageHeaders.Init(MessageVersion version, XmlDictionaryReader reader, IBufferedMessageData bufferedMessageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
   at System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
   at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
   at System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)</StackTrace><ExceptionString>System.Xml.XmlException: Unexpected end of file. Following elements are not closed: Body, Envelope. Line 1, position 2793.
   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowUnexpectedEndOfFile(XmlDictionaryReader reader)
   at System.Xml.XmlUTF8TextReader.ReadAttributes()
   at System.Xml.XmlUTF8TextReader.ReadStartElement()
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlBaseReader.ReadEndElement()
   at System.ServiceModel.Channels.MessageHeaders.Init(MessageVersion version, XmlDictionaryReader reader, IBufferedMessageData bufferedMessageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
   at System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders)
   at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
   at System.ServiceModel.Channels.HttpInput.DecodeBufferedMessage(ArraySegment`1 buffer, Stream inputStream)</ExceptionString></InnerException></Exception></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>0</EventID><Type>3</Type><SubType Name="Transfer">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.8492190Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{faa212a6-54bc-4d7a-a20b-a045ac093ea2}" RelatedActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData></ApplicationData></E2ETraceEvent><E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>131085</EventID><Type>3</Type><SubType Name="Stop">0</SubType><Level>255</Level><TimeCreated SystemTime="2014-01-03T18:14:17.8492190Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{faa212a6-54bc-4d7a-a20b-a045ac093ea2}" /><Execution ProcessName="w3wp" ProcessID="5620" ThreadID="5" /><Channel/><Computer>APPSERVER1</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Stop"><TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx</TraceIdentifier><Description>Activity boundary.</Description><AppDomain>/LM/W3SVC/1/ROOT/Test_ServiceMenuIntegrationService_2_3_6-1-130332464553179690</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><ActivityName>Process action ''.</ActivityName><ActivityType>ProcessAction</ActivityType></ExtendedData></TraceRecord></DataItem></TraceData></ApplicationData></E2ETraceEvent>
Was it helpful?

Solution 2

The problem as it turns out was the Service returned the request and caused the client to have an error. The actual problem was the client machines time was set to the incorrect value, which meant the request was signed in the future and the service rejected it.

I will be sure to recommend the following error message :p

Hey, it hasn't happened, has it? It has "will have going to have happened" happened, but it hasn't actually "happened" happened yet, actually.

OTHER TIPS

Ensure both the WCF client & service in production are configured to extend the default length values as you've shown in the question. Your error message is different from the one usually generated by an insufficient MaxReceivedMessageSize value so there may be another issue in production.

I'd configure the WCF trace settings to also capture the soap messages to see what is the actual length of the "truncate" XML. Add the MessageLogging trace as shown in this SO answer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top