Click here to Skip to main content
13,045,641 members (71,971 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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=""
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            <add baseAddress="http://localhost:8080/Datashop/Documents/"/>

Binding Config:

<binding name="" transferMode="Streamed" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                        maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                        maxNameTableCharCount="2147483647" />

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.
Posted 28-Mar-12 5:06am
Updated 28-Mar-12 6:14am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The problem lies with the fact that we're self-hosting the services with the hostservice calling:


We were stupidly calling the service with the baseAddress:


instead of:


What I still don't understand is why the damn thing worked when the server side had empty strings for the bindingConfiguration name, but at this stage I don't care. I care far more about the vast amounts of beer I'm going to pour down my neck to try and forget the last two days chasing a configuration issue thinking it's a bug in WCF ;)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

        <binding name="FlightInventory_basicHttpBinding" closetimeout="00:20:00" opentimeout="00:20:00">
          receiveTimeout="00:20:00" sendTimeout="00:20:00" allowCookies="false"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
          textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
          <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647">
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientcredentialtype="None" proxycredentialtype="None">
              realm="" />
            <message clientcredentialtype="UserName" algorithmsuite="Default" />
      <service name="FlightInventoryService.FlightInventory" behaviorconfiguration="FlightInventoryService.ServiceBehaviour">
        <endpoint address="" binding="basicHttpBinding" bindingconfiguration="FlightInventory_basicHttpBinding" contract="FlightInventoryService.IFlightInventory">
            <dns value="localhost" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <behavior name="FlightInventoryService.ServiceBehaviour">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <servicemetadata httpgetenabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <servicedebug includeexceptiondetailinfaults="true" />
          <datacontractserializer maxitemsinobjectgraph="2147483647" />
      <add binding="basicHttpsBinding" scheme="https" />
    <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />
Nelek 5-Nov-13 6:36am
If you post HTML please don't forget to use the code tags, if not used the text is totally messed up.

On the other hand... did you realize that you answered to an already solved question from March 2012? If you still want to do it, then please add a tiny explanation. Just a bunch of code brings not much information.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 5 Nov 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100