Question

I have an issue where I'm trying to transfer a large number of objects from my WCF service. I have to limit transfer of objects to 100, otherwise there's some kind of communications error.

I tried the recommendations in the solution, found here, but maybe I'm missing something, as I am still getting the error.

Here is the bottom part of my WCF service's web.config:

 <system.web>
    <httpRuntime maxRequestLength="102400" />
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="MyWsHttpBinding" />
      </wsHttpBinding>
      <netTcpBinding>
        <binding name="myNetTcpBinding"
                 closeTimeout="00:01:00"
                 openTimeout="00:01:00"
                 receiveTimeout="00:10:00"
                 sendTimeout="00:01:00"
                 transactionFlow="false"
                 transferMode="Buffered"
                 transactionProtocol="OleTransactions"
                 hostNameComparisonMode="StrongWildcard"
                 listenBacklog="10"
                 maxBufferPoolSize="2147483647"
                 maxBufferSize="524288"
                 maxConnections="10"
                 maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32"
                        maxStringContentLength="8192"
                        maxArrayLength="16384"
                        maxBytesPerRead="4096"
                        maxNameTableCharCount="16384" />
          <reliableSession ordered="true"
                           inactivityTimeout="00:10:00"
                           enabled="false" />
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="myNetTcpBehaviour">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>        
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="myNetTcpEndPointBehaviour">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

Next, here is the lower part of the web.config portion of the website that consumes the web service:

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IFeederService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="55000" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

    <behaviors>
      <endpointBehaviors>
        <behavior name="myEndPointBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
    </behaviors>

    <client>

      <endpoint address="http://www.mysiate.com/MyService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFeederService"
        contract="FeederService.IFeederService" name="BasicHttpBinding_IFeederService" />
    </client>   </system.serviceModel>

The error I get is:

An error occurred while receiving the HTTP response to http://www.mysite.com/MyService.svc. 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.

The odd thing about this is that as I was writing this post, I retried it with changing the return logic to 190 objects, and it worked. Retried, and it failed.

Is this maybe a matter of changing some IIS settings?

Any assistance on this would be appreciated.

Thanks.

Was it helpful?

Solution

Can't you use a 'Streamed' WCF binding ?

WCF & Streaming

OTHER TIPS

The error message says:

... See server logs for more details.

I would start by configuring tracing on the server as described in this MSDN article.

You haven't declared any endpoints in your service config which means the the WCF default endpoint model is being used

However, you have named your binding configurations and behaviors which means they do not get picked up by the default endpoints. If you remove the names from the binding configuration and behaviors then they will become default settings and will get picked up by the default endpoints

Your binding needs to have the behaviourconfiguration set to your behaviour.

  <endpoint address="http://www.mysiate.com/MyService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFeederService"
    behaviorConfiguration="myEndPointBehavior" contract="FeederService.IFeederService" name="BasicHttpBinding_IFeederService" />
</client>   </system.serviceModel>

Otherwise the graph-settings wont be used

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