-1

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

I have mentioned value in proxy. Do I need to mention in server side WCF Web.Config. If yes then may I know how?

My WCF Web.Config is mentioned below.

<binding name="NewBinding0" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="20000000">                
  <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
  <reliableSession enabled="true" />
    <security mode="None">
      <transport clientCredentialType="None" />
      <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="false" />
    </security>
  </binding>

My Client side coding.

WSHttpBinding binding = new WSHttpBinding();
//binding.ReaderQuotas.MaxArrayLength = 10485760;
//binding.MaxReceivedMessageSize = 10485760;
binding.Security.Mode = SecurityMode.None;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
binding.Security.Message.EstablishSecurityContext = false;
//binding.Security.Message.NegotiateServiceCredential = true;
binding.ReliableSession.Enabled = true;
binding.ReaderQuotas.MaxArrayLength = 2147483647;
binding.ReaderQuotas.MaxDepth = 2147483647;
binding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
binding.ReaderQuotas.MaxBytesPerRead = 2147483647;
binding.MaxReceivedMessageSize = 20000000;
binding.ReaderQuotas.MaxStringContentLength = 2147483647;
binding.SendTimeout = TimeSpan.FromMinutes(10);
binding.CloseTimeout = TimeSpan.FromMinutes(10);
binding.OpenTimeout = TimeSpan.FromMinutes(10);
binding.ReceiveTimeout = TimeSpan.FromMinutes(10);
//EndpointIdentity.CreateUpnIdentity("user@domain");
ChannelFactory<IDBSyncContract> factory = new ChannelFactory<IDBSyncContract>(binding, new EndpointAddress(endPointURL));
dbProxy = factory.CreateChannel();
this.dbProxy = dbProxy as IDBSyncContract;
Tim
  • 28,212
  • 8
  • 63
  • 76
sachin kulkarni
  • 2,618
  • 7
  • 28
  • 33

1 Answers1

0

Is the error occuring when the client sends a message to the server? If so, check to make sure that in your server's config file the endpoint is referencing the binding you created:

<endpoint address="" binding="wsHttpBinding" 
 bindingConfiguration="NewBinding0" contract="IDBSyncContract" />

If you don't reference the binding you created named "NewBinding0" via the endpoint element's bindingConfiguration attribute, WCF will use the default values for WsHttpBinding - which in the case of MaxReceivedMessageSize is 65536.

UPDATE

Setting the MaxReceivedMessageSize value on the server side config is exactly the same as it is on the client config. Simply set the maxReceivedMessageSize attribute on the binding element:

<wsHttpBinding>
  <binding name="NewBinding0" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00" maxReceivedMessageSize="20000000"> 
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    <reliableSession enabled="true" /> 
    <security mode="None">
      <transport clientCredentialType="None" /> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="false" /> 
    </security>
  </binding>
</wsHttpBinding>
Tim
  • 28,212
  • 8
  • 63
  • 76
  • Thanks Tim,But I have mentioned the value while creating the object.I am little confused where to mention the attribute on server side.I tried it to mention on readerQuotas and Binding but to no avail. – sachin kulkarni Aug 02 '11 at 10:14
  • Also Below is the server config file further details. – sachin kulkarni Aug 02 '11 at 10:16
  • Is the address the client uses defined somewhere in the server's config file? If not, I'm wondering if your request from the client might be going to a default endpoint, which would be using a default WsHttpBinding, which might result in this problem. – Tim Aug 02 '11 at 10:20
  • Hi,Tim u mean to say that I need to mention the address "http://192.168.5.170/DBSyncWcfSevice/DBSyncService.svc" somewhere in base address section or in endpoint section. – sachin kulkarni Aug 02 '11 at 10:28
  • I believe so, yes (haven't had a chance to play with WCF 4.0 yet, so just going off what I've read). The other option is to define the default binding for WsHttpBinding for your service so that is picked up by WCF - but I think the simplest would be to add "192.168.5.170/DBSyncWcfService/DBSyncService.svc" to the address attribute of your endpoint element. – Tim Aug 02 '11 at 10:30
  • Thanks Tim, I am also working on .Net 3.5.I have added the link in both baseaddress section and endpoint attribute as well.Now what changes shall I do now in config file for MaxReceivedMessageSize attribute. – sachin kulkarni Aug 02 '11 at 10:41
  • You've already set the maxReceivedMessageSize attribute on the binding element, so you should be good. Give it a try and see what happens. – Tim Aug 02 '11 at 10:42
  • I have mentioned it on Client Side not on Service Config file. – sachin kulkarni Aug 02 '11 at 10:44
  • Ah..just noticed your service config file didn't have the attribute set. I've updated my answer, but in a nutshell you set it in the config file for the server exactly the same way you set it in the client's config file. – Tim Aug 02 '11 at 10:51