Click here to Skip to main content
15,908,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All

Please resolve my query:
While calling from Client to WCF service if WCF response data with 3 to 4 records then client accepts the data and process it but if data size is more than that it is showing The "underlying connection was closed: The connection was closed unexpectedly." . I am using IList object as response object ..

I have added below tag in client
HTML
<configuration>
<system.servicemodel>
    <behaviors>
      <endpointbehaviors>
        <behavior name="myBehavior">
          <callbackdebug includeexceptiondetailinfaults="true" />
          <datacontractserializer maxitemsinobjectgraph="2147483647" />
        </behavior>
      </endpointbehaviors>
    </behaviors>

    <bindings>
      
      <basichttpbinding>
        <binding name="BasicHttpBinding_ISecurity" closetimeout="00:10:00">
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="500000000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true" &gt;
          <readerquotas maxdepth="32" maxstringcontentlength="900000000">
            maxArrayLength="900000000" maxBytesPerRead="900000000" maxNameTableCharCount="900000000" /&gt;
          <security mode="None">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" /&gt;
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_ISecurity1" closetimeout="00:10:00">
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="500000000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true"&gt;
          <readerquotas maxdepth="32" maxstringcontentlength="900000000">
            maxArrayLength="900000000" maxBytesPerRead="900000000" maxNameTableCharCount="900000000" /&gt;
          <security mode="None">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" /&gt;
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_INonFinancialService" closetimeout="00:10:00">
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="500000000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true"&gt;
          <readerquotas maxdepth="64" maxstringcontentlength="900000000">
            maxArrayLength="900000000" maxBytesPerRead="900000000" maxNameTableCharCount="900000000" /&gt;
          <security mode="Message">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" /&gt;
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_INonFinancialService1" closetimeout="00:10:00">
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="500000000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true"&gt;
          <readerquotas maxdepth="32" maxstringcontentlength="900000000">
            maxArrayLength="900000000" maxBytesPerRead="900000000" maxNameTableCharCount="900000000" /&gt;
          <security mode="None">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" /&gt;
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_IFinancialService" closetimeout="00:10:00">
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="500000000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true"&gt;
          <readerquotas maxdepth="32" maxstringcontentlength="900000000">
            maxArrayLength="900000000" maxBytesPerRead="900000000" maxNameTableCharCount="900000000" /&gt;
          <security mode="None">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" /&gt;
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_IFinancialService1" closetimeout="00:10:00">
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="500000000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true"&gt;
          <readerquotas maxdepth="32" maxstringcontentlength="900000000">
            maxArrayLength="900000000" maxBytesPerRead="900000000" maxNameTableCharCount="900000000" /&gt;
          <security mode="None">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" /&gt;
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_INonFinancialService2" closetimeout="00:10:00">
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="500000000" maxBufferPoolSize="524288" maxReceivedMessageSize="500000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
          useDefaultWebProxy="true"&gt;
          <readerquotas maxdepth="32" maxstringcontentlength="900000000">
            maxArrayLength="900000000" maxBytesPerRead="900000000" maxNameTableCharCount="900000000" /&gt;
          <security mode="None">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" /&gt;
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
        <binding name="BasicHttpBinding_INonFinancialService3" closetimeout="00:01:00">
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true"&gt;
          <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
            maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
          <security mode="None">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" /&gt;
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
          </transport></security>
        </readerquotas></binding>
      </basichttpbinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:2402/Security.svc" binding="basicHttpBinding">
        bindingConfiguration="BasicHttpBinding_ISecurity" contract="FeriSecurity.ISecurity"
        name="BasicHttpBinding_ISecurity" behaviorConfiguration="myBehavior" /&gt;
      <endpoint address="http://localhost:2402/Security.svc" binding="basicHttpBinding">
        bindingConfiguration="BasicHttpBinding_ISecurity1" contract="ServiceReference2.ISecurity"
        name="BasicHttpBinding_ISecurity1" behaviorConfiguration="myBehavior" /&gt;
      <endpoint address="http://localhost:2402/NonFinancialService.svc">
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INonFinancialService1"
        contract="NonFinance.INonFinancialService" name="BasicHttpBinding_INonFinancialService"  behaviorConfiguration="myBehavior"/&gt;
      <endpoint address="http://localhost:2402/FinancialService.svc">
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFinancialService"
        contract="FeriFinancialService.IFinancialService" name="BasicHttpBinding_IFinancialService"  behaviorConfiguration="myBehavior" /&gt;
      <endpoint address="http://localhost:2402/FinancialService.svc">
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFinancialService1"
        contract="FeriFinancialService.IFinancialService" name="BasicHttpBinding_IFinancialService1"  behaviorConfiguration="myBehavior"/&gt;
      <endpoint address="http://localhost:2402/NonFinancialService.svc">
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INonFinancialService2"
        contract="NonFinance.INonFinancialService" name="BasicHttpBinding_INonFinancialService1" behaviorConfiguration="myBehavior" /&gt;
      <endpoint address="http://localhost:2402/NonFinancialService.svc">
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INonFinancialService3"
        contract="NonFinance.INonFinancialService" name="BasicHttpBinding_INonFinancialService2" behaviorConfiguration="myBehavior" /&gt;
    </endpoint></endpoint></endpoint></endpoint></endpoint></endpoint></endpoint></client>
  </system.servicemodel>
  <system.web>
    <httpruntime maxrequestlength="2147483647" />
  </system.web>
</configuration>

Please revert .
Posted
Updated 15-Sep-12 10:48am
v2
Comments
Kenneth Haugland 15-Sep-12 11:37am    
Fix formatting, this is difficult to read without proper formatting. Besides there is many way whitch this could go wrong.

1 solution

My first guess is that transferMode="Streamed" is causing you trouble, as it's also set to "Buffered" -> transferMode="Buffered", which is what you usually want.

Have a look at Streaming Message Transfer[^]

[Update]
Now that somebody has formatted the xml: it looks like you have endpoint definitions nested inside each other too.

Best regards
Espen Harlinn
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900