Reputation: 12093
God don't you just love WCF.
I read all possible threads but I am really stuck now.
Here is 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 thrown this default exception ( saw in svclog file):
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.
Now I clearly state that it should be 4mb.
My client code :
TableTaskServiceClient client =
new TableTaskServiceClient(
new BasicHttpBinding { MaxBufferSize = 4194304,
MaxReceivedMessageSize = 4194304 },
new EndpointAddress(GetEndpointAddressString())
);
Yet it throws this 65536 size error at me. Where is it coming from??..
Also does it REALLY matter that client sets up MaxReceivedMessageSize
to same value as server? I think it would be logical that server was responsible for determining length, not client.
There is also this warning (notice how useful it is in what its saying, that is: no information on element that gets overridden or am I missing something), maybe basichttpbinding is exactly what gets overridden ? but why would that be? anyway:
[TraceRecord] Severity Warning TraceIdentifier http://msdn.microsoft.com/en-US/library/System.ServiceModel.OverridingDuplicateConfigurationKey.aspx Description The configuration system has detected a duplicate key in a different configuration scope and is overriding with the more recent value. AppDomain /LM/W3SVC/11/ROOT/TableTaskService-33-1296567 Source System.ServiceModel.Configuration.ServiceBehaviorElementCollection/-851144413 ElementName behavior OldElementLineNumber 0 NewElementLineNumber 0
UPDTE: reconfigured both service and 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()));
Same error still.
If that is of some interest I am sending a byte[] array of 467000~ length
Upvotes: 6
Views: 1833
Reputation: 59151
Try this:
<basicHttpBinding>
<binding name="BaseHttp"
maxBufferSize="4194304"
maxBufferPoolSize="4194304"
maxReceivedMessageSize="4194304">
<readerQuotas maxArrayLength="4194304"
maxBytesPerRead="4194304"
maxDepth="4194304"
maxNameTableCharCount="4194304"
maxStringContentLength="4194304"
/>
</binding>
</basicHttpBinding>
Though some of those settings don't make sense, I simply set them to a large value.
Also, once you get this working I highly suggest you trim down the values, since they're present to prevent DoS attacks on your site.
Upvotes: 1