0

I've referred to several stackoverflow threads on the above matter, but even after applying the solutions mentioned, I still get the same error.

I adjusted the settings as per this and this, so my web.config in the client and app.config in the WCF service look as follows:

web.config:

 <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding maxReceivedMessageSize="10485760" name="WSHttpBinding_IMessengerService">
          <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </wsHttpBinding>
    </bindings>
     <behaviors >
  <endpointBehaviors>
    <behavior name="WSHttpBinding_IMessengerService">
      <dataContractSerializer maxItemsInObjectGraph="2147483646"/>
    </behavior>
  </endpointBehaviors>
</behaviors>
    <client>
      <endpoint address="http://localhost:8005/MessengerService/Service" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMessengerService" contract="MessengerService.IMessengerService">
        <identity>
          <servicePrincipalName value="Local Network" />
        </identity>
      </endpoint>  
    </client>
  </system.serviceModel>

App.config:

<system.serviceModel>
<services>
  <!-- This section is optional with the new configuration model introduced in .NET Framework 4. -->
  <service name="Omnix.Messenger.Service.MessengerService" behaviorConfiguration="MessengerServiceBehavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8005/MessengerService/Service" />
      </baseAddresses>
    </host>

    <!-- this endpoint is exposed at the base address provided by host: http://localhost:8005/MessengerService/service  -->
    <endpoint address="" binding="wsHttpBinding" contract="Omnix.Messenger.Service.Contract.IMessengerService" />

    <!-- the mex endpoint is exposed at http://localhost:8005/MessengerService/service/mex -->
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MessengerServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

Can someone please point out what I'm doing wrong, and how to resolve the issue?

Community
  • 1
  • 1
devC
  • 1,384
  • 5
  • 32
  • 56
  • You have tweaked message size as I see, but I do not see maxBufferSize="20481000" maxBufferPoolSize="524288" . Without increasing buffers, changing of max message size makes no sense – Mimas Nov 17 '15 at 14:16
  • When I add maxBufefrSize, I get an error saying that it's not allowed. It seems this attribute is not available for wsHttpBinding binding. – devC Nov 18 '15 at 10:51
  • Ok. so according to this (https://social.msdn.microsoft.com/Forums/vstudio/en-US/fd4c0135-62aa-4a23-b69d-2435e8c4b414/no-maxbuffersize-setting-for-wshttpbinding) you can try playing with maxBufferPoolSize only – Mimas Nov 18 '15 at 11:03
  • Yes, I did. I also tried Ricado's instruction. Still the issue is there :( – devC Nov 18 '15 at 11:19

1 Answers1

0

You also need to set the same configuration on server side. In your app.config add the binding configuration:

 <system.serviceModel>
    <!-- add the lines below -->
    <bindings>
      <wsHttpBinding>
         <binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" name="WSHttpBinding_IMessengerService">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
      </wsHttpBinding>
    </bindings>

Also change Web.config:

 <binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" name="WSHttpBinding_IMessengerService">
          <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>

Hope it helps

Ricardo Pontual
  • 3,749
  • 3
  • 28
  • 43