Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8127077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:23:38+00:00 2026-06-06T07:23:38+00:00

I have a WCF service that can return large amount of data depending on

  • 0

I have a WCF service that can return large amount of data depending on input parameters.

The service is running on my machine as a ServiceHost executable and I am using WCF Test client for testing now.

Here is my host config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_ExchangeRepository"
                         closeTimeout="00:01:00" openTimeout="00:01:00"
                         receiveTimeout="00:10:00" sendTimeout="00:10:00"
                         transactionFlow="false" transferMode="Streamed"
                         transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard"
                         listenBacklog="500"    maxBufferPoolSize="2147483646"
                         maxBufferSize="2147483646" maxConnections="500"
                         maxReceivedMessageSize="2147483647"  >
                    <readerQuotas
                        maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                        maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
                    <security mode="None">
                    </security>
                </binding>          
            </netTcpBinding>
        </bindings>         
        <services>          
            <service name="MyCompany.MyApplication.DataServices.ExchangeRepository" 
                     behaviorConfiguration="MyCompany.MyApplication.DataServicesBehavior">
                <endpoint address ="" 
                          binding="netTcpBinding" 
                          contract="MyCompany.MyApplication.DataServices.IExchangeRepository"
                          bindingConfiguration="NetTcpBinding_ExchangeRepository" 
                          behaviorConfiguration="MyCompany.MyApplication.EndpointBehavior">
                    <identity>
                        <dns value="localhost"/>
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
                <host>
                    <baseAddresses>
                        <add baseAddress = "net.tcp://localhost:8896/ExchangeRepository/" />
                        <add baseAddress = "http://localhost:8895/ExchangeRepository/" />
                    </baseAddresses>
                </host>
            </service>
        </services>         
        <behaviors>
            <serviceBehaviors>
                <behavior name="MyCompany.MyApplication.DataServicesBehavior">
                    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
                    <serviceMetadata httpGetEnabled="True"/>
                    <serviceDebug includeExceptionDetailInFaults="True" />
                </behavior>
            </serviceBehaviors>
            <endpointBehaviors>
                <behavior name="MyCompany.MyApplication.EndpointBehavior">
                    <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
                </behavior>
            </endpointBehaviors>
        </behaviors>    
    </system.serviceModel>
</configuration>

Here is my client config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <behaviors>
            <endpointBehaviors>
                <behavior name="endpointBehaviour">
                    <dataContractSerializer maxItemsInObjectGraph="2147483647" />
                </behavior>
            </endpointBehaviors>
        </behaviors>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_IExchangeRepository" closeTimeout="00:10:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    transactionFlow="false" transferMode="Streamed" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="2147483647" maxConnections="10"
                    maxReceivedMessageSize="2147483647">
                    <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                        maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="None">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://localhost:8896/ExchangeRepository/"
                behaviorConfiguration="endpointBehaviour" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IExchangeRepository" contract="IExchangeRepository"
                name="NetTcpBinding_IExchangeRepository">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

And here is the error I am getting:

The socket connection has been disposed.

Server stack trace: 
   at System.ServiceModel.Channels.SocketConnection.ThrowIfNotOpen()
   at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
   at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
   at System.ServiceModel.Channels.PreReadConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
   at System.ServiceModel.Channels.SingletonConnectionReader.SingletonInputConnectionStream.ReadCore(Byte[] buffer, Int32 offset, Int32 count)
   at System.ServiceModel.Channels.SingletonConnectionReader.SingletonInputConnectionStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.ServiceModel.Channels.MaxMessageSizeStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.ServiceModel.Channels.SingletonConnectionReader.Close(TimeSpan timeout)
   at System.ServiceModel.Channels.SingletonConnectionReader.SingletonInputConnectionStream.Close()
   at System.ServiceModel.Channels.DelegatingStream.Close()
   at System.Xml.XmlBufferReader.Close()
   at System.Xml.XmlBaseReader.Close()
   at System.Xml.XmlBinaryReader.Close()
   at System.Xml.XmlReader.Dispose(Boolean disposing)
   at System.Xml.XmlReader.Dispose()
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
   at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IExchangeRepository.SearchExchangeRequest(String AccountNumber, Int32 StatusCode, Int32 StartDate, Int32 EndDate)
   at ExchangeRepositoryClient.SearchExchangeRequest(String AccountNumber, Int32 StatusCode, Int32 StartDate, Int32 EndDate)

Inner Exception:
The socket connection has been disposed.
Object name: 'System.ServiceModel.Channels.SocketConnection'.

The error is occurs when returning data has more than some number of records. With less data everything is working as expected.

Any suggestions on how to solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:23:40+00:00Added an answer on June 6, 2026 at 7:23 am

    Well it all was caused by stupid data issue.
    The error message is absolutely useless. Enabling tracing allowed to see the actual exception.
    Thank you, EkoostikMartin!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a RESTful WCF service that can return XML, JSON, or JSONP, depending
I have a WCF service that can return a stream via a WebGet. This
I have a WCF service that can return several different collections. Objects in each
I have a WCF service that I can debug. I put a breakpoint in
I have a WCF service that accesses a SQL database to fetch data .
I have a WCF service that accepts requests from JQuery. Currently, I can access
I have a WCF service that can receive several requests/minute (or seconds) that need
I have a WCF service that uses ODP.NET to read data from an Oracle
Lets say I have a WCF service that a client can use to receive
I have a WCF service. I can return a concrete class without a problem,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.