Hello everyone,
I'm facing a configuration issue concerning my WCF Streaming service. I've got a Windows service that self-hosts 3 WCF Services, one of which handles the uploading and downloading of binary content using Streams. The documentation around states that you have to set
maxReceivedMessageSize
to a suitably high number (eg. 2147483647) to be able to receive larger messages, which is what we did.
Service Config:
<service name="DocumentService" behaviorConfiguration="DatashopServiceBehavior">
<endpoint contract="IDocumentService" address="DocumentService"
binding="basicHttpBinding" name="basicHttpBinding" bindingConfiguration=""
behaviorConfiguration="DatashopServiceEndpointBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/Datashop/Documents/"/>
</baseAddresses>
</host>
</service>
Binding Config:
<basicHttpBinding>
<binding name="" transferMode="Streamed" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
You'll notice that there is an empty string value for the bindingConfiguration attribute of the endpoint, and an empty string for the name attribute of the binding itself. That's because this is the only way we got it to work. If we explicitly name the binding and reference it from the endpoint using that name, it's as if the maxReceivedMessageSize property is never set and large binary contents give us the following error in the WCF Service Trace Viewer:
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.
My colleague has isolated the streaming service and inspected the configuration at run time using reflection and has found that the maxReceivedMessageSize is set correctly, but somehow doesn't get applied.
While we can fix our current problem by naming and referencing the binding configuration using the emtpy string, it doesn't solve the underlying issue and means if we want to set up a different endpoint on the same service but with a different binding, we can't.
Further info: the EndpointBehavior is WCFExtras to flatten the WSDL and we're not using a service client, instead we're using
ChannelFactory<T>
Has anyone experienced this issue before, and what was the solution to it?
Any help will be greatly appreciated.