WCF MaxReceivedMessageSize property not taking
Asked Answered
W

3

4

Searched with no luck...

I keep getting

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.

It makes sense, so I go into both Server and client config and make the change:

Client

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IFileUpload"
           closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transferMode="Streamed" messageEncoding="Text" maxBufferSize="65536" maxReceivedMessageSize="67108864">
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/services/FileUpload.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileUpload"
          contract="CFTW.FileUpload.IFileUpload" name="BasicHttpBinding_IFileUpload" />
    </client>
  </system.serviceModel>

Server

    <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IFileUpload"

                 transferMode="Streamed" messageEncoding="Text" maxBufferSize="67108864" maxBufferPoolSize="67108864" maxReceivedMessageSize="67108864">

        </binding>
      </basicHttpBinding>

    </bindings>
    <services>
      <service name="BasicHttpBinding_IFileUpload">
        <endpoint address="~/services/FileUpload.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileUpload"
            contract="CFTW.FileUpload.IFileUpload"></endpoint>
      </service>

    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

I'm not sure why it's not working (otherwise I'd fix it:)). It's running on .NET 4.0 RC.

Wriggler answered 2/4, 2010 at 23:33 Comment(2)
if you're trying to do file upload (as your behavior name seems to indicate), I'd check out WCF streaming instead of just upping the maxreceivedmessagesize parameter....Disposed
Huh...I thought I was doing WCF streaming. I thought thats what trasferMode="Streamed" was for?Wriggler
B
3

I just ran into this issue. I found that my custom binding did not get applied at all. Then I used name = "" in binding tag. Then everything started working with the new settings. This is due to .NET 4.0 comes with default binding/endpoint/behavior configurations. These default settings have name = "". I just modified the default binding itself. The reason for my custom binding(named) did not get applied is due to the value for the name in <service> tag. It should follow <Namespace.ServiceClassName>.

Belting answered 16/10, 2012 at 21:57 Comment(1)
which binding name did you set to ""? in the client config?Threecolor
B
2

You need to increase the attribute maxReceivedMessageSize in the client config for the binding. Also, be sure to set the same value for the maxBufferSize. For buffered connection these two values need to be same.

Blunge answered 24/8, 2011 at 9:9 Comment(0)
R
0

Had the same problem, luckily in a second project and could compare with the working project. The difference was that the working project had additional attributes set in the web.config for the service bindings...

Working sample: httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"

The second project only had: httpsTransport

Also do a search in your project for 65536 as it is also defined in configuration.svcinfo and configuration91.svcinfo of the service reference.

Ramify answered 3/12, 2015 at 13:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.