Hi,

When I call a method of my WCF service which returns a simple entity
with a few properties, it works fine.

However when I call a method which returns a more complex entity,
which holds a collection of other entities, then I get the exception I
mentioned in the title.

I've used the following in the client app.config  :

 <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IMetricaService"
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">
                    <readerQuotas maxDepth="32"
maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None"
proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName"
algorithmSuite="Default" />
                    </security>
                </binding>

                <binding
name="BasicHttpBinding_IncreasedMessageSize_Buffered"
closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:05:00" sendTimeout="00:05:00"
transferMode="Streamed" maxBufferSize="524288"
maxReceivedMessageSize="2147483647">
                  <readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:4820/Service.svc";
binding="basicHttpBinding"
 
bindingConfiguration="BasicHttpBinding_IMetricaService"
contract="ServiceReference1.IMetricaService"
                name="BasicHttpBinding_IMetricaService"
behaviorConfiguration="debuggingBehaviour" />
        </client>

      <behaviors>
        <endpointBehaviors>
          <behavior name="debuggingBehaviour">
            <dataContractSerializer maxItemsInObjectGraph="2147483647"/
>
          </behavior>
        </endpointBehaviors>
      </behaviors>
    </system.serviceModel>


When I instantiate my service using the
BasicHttpBinding_IMetricaService binding, I get the exception.

However if I instantiate my service using the
BasicHttpBinding_IncreasedMessageSize_Buffered (recommended on a few
blogs out there), I get the following exception :

The remote server returned an unexpected response: (400) Bad Request.


On the service side, the web.config looks like :

<system.serviceModel>
    <services>
      <service name="metricaService"
behaviorConfiguration="DefaultBehavior">
        <endpoint address="" binding="basicHttpBinding"
contract="Metrica.Service.ServiceContract.IMetricaService"
bindingConfiguration="BasicHttpBinding_IncreasedMessageSize_Buffered" /
>
        <endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DefaultBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IncreasedMessageSize_Buffered"
                  maxBufferSize="524288"
maxReceivedMessageSize="2147483647"
                  closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:05:00"
                  sendTimeout="00:05:00" transferMode="Streamed">
          <readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647"
            maxNameTableCharCount="2147483647" />
        </binding>
        </basicHttpBinding>
    </bindings>
  </system.serviceModel>

and I've also specified :

<httpRuntime maxRequestLength="2097151"/>


Anyone has an idea what could be wrong with the above ?

Thanks

Reply via email to