God, you just don't like WCF.
I read all the possible topics, but now I'm really stuck.
Here is the WCF configuration:
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="BaseHttp" maxBufferSize="4194304" maxBufferPoolSize="4194304" maxReceivedMessageSize="4194304" /> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="TaskServiceBehavior"> <serviceMetadata httpGetEnabled="True" /> <serviceDebug includeExceptionDetailInFaults="True" /> </behavior> <behavior name=""> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="TaskServiceBehavior" name="TaskService"> <endpoint address="http://www.mysite.com/TableTaskService/TableTaskService.svc" binding="basicHttpBinding" bindingConfiguration="BaseHttp" contract="TableTaskService.ITableTaskService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://www.mysite.com/TableTaskService/" /> </baseAddresses> </host> </service> </services> <serviceHostingEnvironment> <baseAddressPrefixFilters> <add prefix="http://www.mysite.com/" /> </baseAddressPrefixFilters> </serviceHostingEnvironment> </system.serviceModel>
Now I send a message and get this exception by default (saw in the svclog file):
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property in the corresponding bind element.
Now I clearly state that it should be 4 MB.
My client code:
TableTaskServiceClient client = new TableTaskServiceClient( new BasicHttpBinding { MaxBufferSize = 4194304, MaxReceivedMessageSize = 4194304 }, new EndpointAddress(GetEndpointAddressString()) );
But he changes this error of size 65536. Where does this come from? ..
And does it really matter that the client sets MaxReceivedMessageSize to the same value as the server? I think it would be logical that the server was responsible for determining the length, and not for the client.
There is also this warning (note how useful this is in saying it, that is: there is no information about an element that becomes overridden, or I am missing something), maybe basichttpbinding is exactly what becomes overridden ? but why was that? anyway:
[TraceRecord] TraceIdentifier Severity Warning http://msdn.microsoft.com/en-US/library/System.ServiceModel.OverridingDuplicateConfigurationKey.aspx Description The configuration system detected a duplicate key in various configuration parameters and overrides later costs. AppDomain / LM / W3SVC / 11 / ROOT / TableTaskService-33-1296567 Source System.ServiceModel.Configuration.ServiceBehaviorElementCollection / -851144413 ElementName behavior OldElementLineNumber 0 NewElementLineNumber 0
UPDTE: reconfigured both the service and the client:
TableTaskServiceClient client = new TableTaskServiceClient( new BasicHttpBinding { MaxBufferSize = 4194304, MaxReceivedMessageSize = 4194304, MaxBufferPoolSize=4194304, ReaderQuotas = new XmlDictionaryReaderQuotas { MaxArrayLength = 4194304, MaxBytesPerRead = 4194304, MaxDepth = 4194304, MaxNameTableCharCount = 4194304, MaxStringContentLength = 4194304 } }, new EndpointAddress(GetEndpointAddressString()));
The same mistakes.
If this is interesting, I send a byte [] array of length 467000 ~