2010-03-05 7 views
12

Ich bekomme diese Ausnahme auf der Client-Anwendung, nicht sicher, wie Sie darüber hinauskommen. Ich erhalte diese Ausnahme, wenn die zurückgegebenen Daten (eine Liste der Preise) 15 MB überschreitet, aber für eine Nachrichtengröße von weniger als 15 MB funktioniert.System.ServiceModel.CommunicationException - auf große Nachricht Größe

Fehlermeldung:

ist ein Fehler aufgetreten, während die HTTP-Antwort empfangen zu "http://localhost:8782/CMDService". Dies könnte daran liegen, dass die Service-Endpunktbindung das HTTP-Protokoll nicht verwendet. Dies kann auch daran liegen, dass ein HTTP-Anforderungskontext vom Server abgebrochen wird (möglicherweise aufgrund des Herunterfahrens des Dienstes). Weitere Informationen finden Sie in den Serverprotokollen.

Trace O/P für Client von TraceViewer:

<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>CMD.Web.Test.exe</AppDomain> 
<Exception> 
<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> 
<Message>An error occurred while receiving the HTTP response to "http://localhost:8782/CMDService". 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.</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.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; msgData, Int32 type) 
at CMD.Client.Interface.ICMDService.GetData(String region, DateTime QuoteDate) 
at CMD.Web.Test.Program.TestGetData() 
at CMD.Web.Test.Program.Main(String[] args) 
</StackTrace> 
<ExceptionString>System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to "http://localhost:8782/CMDService". 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.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.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: An unexpected error occurred on a receive.</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: An unexpected error occurred on a receive. ---&gt; System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---&gt; 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.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.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)</ExceptionString> 
<InnerException> 
<ExceptionType>System.IO.IOException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> 
<Message>Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.</Message> 
<StackTrace> 
at System.Net.Sockets.NetworkStream.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) 
</StackTrace> 
<ExceptionString>System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---&gt; 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.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) 
    at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)</ExceptionString> 
<InnerException> 
<ExceptionType>System.Net.Sockets.SocketException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType> 
<Message>An existing connection was forcibly closed by the remote host</Message> 
<StackTrace> 
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) 
</StackTrace> 
<ExceptionString>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)</ExceptionString> 
<NativeErrorCode>2746</NativeErrorCode> 
</InnerException> 
</InnerException> 
</InnerException> 
</Exception> 
</TraceRecord> 
</DataItem> 
</TraceData> 
</ApplicationData> 

auf dem Service-Tracing berichten konnten keine Ausnahmen

Config sowohl Service und Client identisch sind

<basicHttpBinding> 
     <binding name="CMDServiceBinding" 
       receiveTimeout="00:10:00" 
       closeTimeout="00:10:00" 
       openTimeout="00:10:00" 
       sendTimeout="00:10:00" 
       maxBufferSize="2147483647" 
       maxBufferPoolSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 

      <readerQuotas maxDepth="2147483647" 
         maxStringContentLength="2147483647" 
         maxArrayLength="2147483647" 
         maxBytesPerRead="2147483647" 
         maxNameTableCharCount="2147483647" /> 
     </binding> 
</basicHttpBinding> 

<behaviors> 
     <serviceBehaviors> 
     <behavior name="UBS.Firc.Broil.CMD.QuotesServiceBehavior"> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
     </behavior> 
     </serviceBehaviors> 
</behaviors> 

Beliebig Hilfe würde sehr geschätzt werden. Dank

+0

Ich löste meine Frage, wie ich hier erklärt: http://stackoverflow.com/questions/5537794/Fehler-während-deserializing-das-Objekt-in-wcf/8415908 # 8415908 – Adi

Antwort

7

Wenn Ihr Dienst von ASP.NET gehostet wurde, können Sie Größe max Upload von ASP.NET zu erhöhen:

<system.web> 
    <httpRuntime maxRequestLength="2147483647" /> 
    </system.web> 
8

kurz in Verhaltensweisen, die Sie ServiceBehavior und endpointBehavior haben. Sie sollten so etwas schreiben:

<behaviors> 
    <endpointBehaviors> 
     <behavior> 
     <dataContractSerializer maxItemsInObjectGraph="10000000"/> 
     </behavior> 
    </endpointBehaviors> 
    <serviceBehaviors> 
     <behavior> 
     <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
     <serviceMetadata httpGetEnabled="true" />    
     <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
    </serviceBehaviors> 
    </behaviors> 

In der Hoffnung, dass hilft!

+2

Ich bekam den gleichen Fehler in meiner Anwendung, so dass ich Tracing (Anweisungen [hier] (http://msdn.microsoft.com/en -us/library/ms732023.aspx)), die eine viel mehr Beschreibung zeigten Fehlermeldung, die mich auf diese Lösung hingewiesen hat. –

8

hoffen, dass es Ihnen helfen kann ...

<bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_IVtmWebResolution" maxBufferSize="2147483647" receiveTimeout="00:10:00" sendTimeout="00:10:00" 
        maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
         maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
        <security mode="None" /> 
       </binding> 
      </basicHttpBinding> 
     </bindings> 

Glückliche Coding

Verwandte Themen