C # WCF: WCF service returns (404) invalid request when sending an array of elements

I am trying to send an array of approximately 50 elements to a WCF service method, but I always get a (404) Bad Request error.

I think this is due to the size of the message or something similar, because if I send an empty array, it will work.

I did some research and added some things to web.config WCF, but I still can't get it to work.

Can someone provide further information on how I can possibly increase the size of the message I can send ?




[UPDATE] Solution:

Decision

+3
c # wcf wcf-binding
Apr 11 '09 at 12:58
source share
3 answers

Stupid, stupid of me: (

The thing is, I created the binding configuration in the web.config file as follows:

 <bindings> <wsHttpBinding> <binding name="netTcpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="6000000"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="6000000" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> </binding> </wsHttpBinding> </bindings> 

But then I did not apply the configuration to the endpoint! So, I had to add this to the endpoint tag:

 bindingConfiguration="netTcpBindingConfig" 

Now it works like a charm.

+2
Apr 11 '09 at 13:30
source share

This is obvious, but you tried setting MaxReceivedMessageSize to 65536 and see if it still doesn't work?

0
Apr 11 '09 at 13:06
source share

Your service host must be configured to receive a large set of data; if not, it is either discarded at the service level.

  • Add a link to System.Runtime.Serialization.
  • When creating a set of bindings, message size:

     return new NetTcpBinding(SecurityMode.None, true) { MaxReceivedMessageSize = 99999999, ReaderQuotas = { MaxArrayLength = 99999999 } };
    return new NetTcpBinding(SecurityMode.None, true) { MaxReceivedMessageSize = 99999999, ReaderQuotas = { MaxArrayLength = 99999999 } }; 
0
Apr 11 '09 at 13:06
source share



All Articles