none
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.

    Question

  • Iam using a WCF service, which has one function that returns the xml data from a table with more than 50,000 record. When I execute the function I get the following exception...

     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 works find with 100-200 records....

     Can anyone help me solve this issue... I have to render all the records..
     

    Thursday, July 24, 2008 10:27 AM

Answers

  •  Shouldnt we set the ServiceReferences.ClientConfig? I think we should edit the bold one.

    <configuration>
        <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_IService" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647">
                        <security mode="None" />
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://59.149.117.93/SteveWeb/SteveService/Service.svc"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
                    contract="SteveSLWeb.SteveWebService.IService" name="BasicHttpBinding_IService" />
            </client>
        </system.serviceModel>
    </configuration>

    Please let me know if I am wrong

    Friday, July 25, 2008 7:41 AM
  • You must cinfigurate it at web.config:

    <system.serviceModel>
      <services>
        <service
            name="Microsoft.ServiceModel.Samples.CalculatorService"
            behaviorConfiguration="CalculatorServiceBehavior">
          <!-- use base address provided by host -->
          <!-- specify BasicHttp binding and a binding configuration to use -->
          <endpoint address=""
                    binding="basicHttpBinding"
                    bindingConfiguration="Binding1"
                    contract="Microsoft.ServiceModel.Samples.ICalculator" />
        </service>
      </services>

      <bindings>
        <!--
              Following is the expanded configuration section for a BasicHttpBinding.
              Each property is configured with the default value.
              See the TransportSecurity, and MessageSecurity samples in the
              Basic directory to learn how to configure these features.
              -->
        <basicHttpBinding>
          <binding name="Binding1"
                   hostNameComparisonMode="StrongWildcard"
                   receiveTimeout="00:10:00"
                   sendTimeout="00:10:00"
                   openTimeout="00:10:00"
                   closeTimeout="00:10:00"
                   maxReceivedMessageSize="65536"
                   maxBufferSize="65536"
                   maxBufferPoolSize="524288"
                   transferMode="Buffered"
                   messageEncoding="Text"
                   textEncoding="utf-8"
                   bypassProxyOnLocal="false"
                   useDefaultWebProxy="true" >
            <security mode="None" />
          </binding>
        </basicHttpBinding>
      </bindings>

      <!--For debugging purposes set the returnUnknownExceptionsAsFaults attribute to true-->
      <behaviors>
        <serviceBehaviors>
          <behavior name="CalculatorServiceBehavior">
            <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
        </serviceBehaviors>
      </behaviors>

    </system.serviceModel>

    Thursday, July 24, 2008 2:15 PM

All replies

  • Hi,

    You can set at web.config MaxReceivedMessageSize property to another value. 65536 - is default value for this property.

    Thursday, July 24, 2008 10:34 AM
  •  There is also a config file inside silverlight called "ServiceReferences.ClientConfig" that can also be the culprit and might need to have its max values set.

    Thursday, July 24, 2008 1:30 PM
  • You must cinfigurate it at web.config:

    <system.serviceModel>
      <services>
        <service
            name="Microsoft.ServiceModel.Samples.CalculatorService"
            behaviorConfiguration="CalculatorServiceBehavior">
          <!-- use base address provided by host -->
          <!-- specify BasicHttp binding and a binding configuration to use -->
          <endpoint address=""
                    binding="basicHttpBinding"
                    bindingConfiguration="Binding1"
                    contract="Microsoft.ServiceModel.Samples.ICalculator" />
        </service>
      </services>

      <bindings>
        <!--
              Following is the expanded configuration section for a BasicHttpBinding.
              Each property is configured with the default value.
              See the TransportSecurity, and MessageSecurity samples in the
              Basic directory to learn how to configure these features.
              -->
        <basicHttpBinding>
          <binding name="Binding1"
                   hostNameComparisonMode="StrongWildcard"
                   receiveTimeout="00:10:00"
                   sendTimeout="00:10:00"
                   openTimeout="00:10:00"
                   closeTimeout="00:10:00"
                   maxReceivedMessageSize="65536"
                   maxBufferSize="65536"
                   maxBufferPoolSize="524288"
                   transferMode="Buffered"
                   messageEncoding="Text"
                   textEncoding="utf-8"
                   bypassProxyOnLocal="false"
                   useDefaultWebProxy="true" >
            <security mode="None" />
          </binding>
        </basicHttpBinding>
      </bindings>

      <!--For debugging purposes set the returnUnknownExceptionsAsFaults attribute to true-->
      <behaviors>
        <serviceBehaviors>
          <behavior name="CalculatorServiceBehavior">
            <serviceDebug includeExceptionDetailInFaults="true" />
          </behavior>
        </serviceBehaviors>
      </behaviors>

    </system.serviceModel>

    Thursday, July 24, 2008 2:15 PM
  •  Sergy... Im not discrediting that... only that the web.config file is the solution if he is getting the information from a WCF service from asp.net. If you are talking to WCF from silverlight directly then you have to take that same binding configuration and do it in the config file for silverlight which is not the web.config file.

    Thursday, July 24, 2008 3:22 PM
  •  Shouldnt we set the ServiceReferences.ClientConfig? I think we should edit the bold one.

    <configuration>
        <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_IService" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647">
                        <security mode="None" />
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://59.149.117.93/SteveWeb/SteveService/Service.svc"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
                    contract="SteveSLWeb.SteveWebService.IService" name="BasicHttpBinding_IService" />
            </client>
        </system.serviceModel>
    </configuration>

    Please let me know if I am wrong

    Friday, July 25, 2008 7:41 AM
  • Im getting data using web service and wish to get about 1000 record from web service. As discuss above, i change my serveicereferences.clientconfig like below :

        <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="LoggedInUsersSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
                      <security mode="None" />
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://localhost/MyService/LoggedInUsers.asmx"
                    binding="basicHttpBinding" bindingConfiguration="LoggedInUsersSoap"
                    contract="SLTest.MyServiceRef.LoggedInUsersSoap" name="LoggedInUsersSoap" />
            </client>
        </system.serviceModel>

     

    But i still getting the same error, I dont why. Can somebody help!

    Monday, August 04, 2008 5:03 AM
  • Well I have made the changes in my web.config as you mentioned but I still receive the same error message, i am unable to understand why it is keep showing me that error.

    Monday, February 23, 2009 8:18 AM
  • web.config? I think it should be in ServiceReferences.ClientConfig.
    Monday, February 23, 2009 9:45 PM
  • Change should be on the ServiceReferences.ClientConfig, but in my case even though I had changed it I was still getting the error. Then I realized I was creating the binding dynamically in code, so if you are doing the same make sure you set the MaxReceivedMessageSize there, e.g.

    BasicHttpBinding binding - new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
    binding.MaxReceivedMessageSize = 2147483647;

    cheers,

    AN.

    Tuesday, March 17, 2009 2:19 PM
  •  Where is the ServiceReferences.ClientConfig located?

     

    EDIT: I found it.

     I'm using the WCF test Client, you can edit the client config file in that.

    • Proposed as answer by Ravin Singh Friday, February 14, 2014 2:16 PM
    Monday, May 03, 2010 10:29 PM
  • binding.MaxReceivedMessageSize = 2147483647;

    Also used this mehod to solve my issue for a dynamic proxy setting.

    Thanks for the info.

    AH

    Friday, August 06, 2010 12:40 AM
  • Hey guys,

    I had the same problem - server could not receive big message,

    so i increased maxReceivedMessageSize but got the same error...

    This is my config:

    <system.serviceModel>
                <behaviors>
          <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
        <bindings>
          <basicHttpBinding>
            <clear/>
            <binding name="MyBinding1" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
          </basicHttpBinding>
        </bindings>
        <services>
          <service name="CSISWebService">
            <clear />
            <endpoint binding="basicHttpBinding" bindingConfiguration="MyBinding1"
              contract="ICSISWebService" />
          </service>
        </services>
      </system.serviceModel>

     

    Looks Ok, right? But problem is that configuration is not picked up by the server.

    After pocking around I discovered that if I remove bindingConfiguration parameter from endpoint configuration and remove name for my binding - config is used - message size is increased.  But I do use correct config, and in endpoint say clearly what binding to use....WTF?

    Any ideas why it doesn't work with name and DOES work if no name used?

    Tuesday, September 14, 2010 2:48 PM
  • Good point, thanks Anoguei, you may need to add the "binding.MaxBufferSize = 2147483647" as well. "ServiceReferences.ClientConfig" will get auto updated once you've updated or re-configured the service reference. Hence if you've provided correct binding configurations at the service level using "App.config" of your WCF service lib, that configuration will get auto inherited to the consuming silverlight client. But all these will not come to effect if you are creating the bindings dynamically in code. E.g.

    • BasicHttpBinding    WCFServiceBind                      = new BasicHttpBinding();
    • EndpointAddress     WCFServiceEndPoint             = new EndpointAddress(WCFServiceEndPointAddress);
    • WCFServiceBind.MaxBufferSize = 2147483647;
    • WCFServiceBind.MaxReceivedMessageSize = 2147483647;
    • etc....
    • WCFServiceClientObj = new Service1Client(WCFServiceBind, WCFServiceEndPoint);
    Wednesday, November 10, 2010 12:52 AM
  • You are probably having the same problem I am. You can change the config file on the server side until your face turns blue, but it's not going to help unless the client side can also handle that. In my case, I'm using the WCF Test Client built into VS2010. If you look in the tree on the left, you should see "config file". This is the config file the utility uses to connect to the service. Notice that it suffers from the same 65536 MaxRecievedMessageSize as the server. This has to be changes as well. I can't figure out how to change this config file.

    If someone has an answer for that one, I'd appreciate it (as would others in this thread I'm sure). In the meantime, I'll see if I can figure it out. If I do, I'll post the solution.

    Wednesday, November 24, 2010 12:16 AM
  • So here's the answer for you folks using the WCF Test Client. It's a hack, but it works!! Solution is below. Found the answer here (thanks Herve Roggero) :  http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/dde72fbe-e741-48fd-a9e1-253800d5227a/

     

    Well, I was facing a similar challenge. There is a manual way to do this until the tool gets updated.

     

    Start the client interface (WcfTestClient.exe) with the WCF Service HTTP

    Expand the service and right-click on the Web.Config (do not double-click - this will load the config file)

    Click on Copy Full Path

    Go to the file and edit the configuration sections you need to change (buffer limits, dns identity for https...)

     

    You can now start using the tool with a modified config file.

     

    Unfortunately everytime you restart the tool a new config file gets generated in a different folder. So this is a manual step. Still it helped me test an HTTPS endpoint that required changing the config file.

     

    Hope this helps

    Wednesday, November 24, 2010 12:30 AM
  • To: vit100 THANK YOU SO MUCH!!!  WOW....I can't believe I tried what you said in your post and it magically worked.  I spent 10 hrs today trying to fix this stupid problem and nothing else worked but this.  This has to be a bug!!!  Can someone from Microsoft please confirm this is an issue?  

    Currently running:
    VS2010 Premium 10.0.30319.1 RTMRel
    .NET Framework 4


    -Bernard

    Sunday, December 19, 2010 5:25 AM
  • got an error so i tried to repost.

    Sunday, December 19, 2010 5:33 AM
  • @vit100: I still do not believe it, your workaround actually ...works!
    I just spent the whole day on wondering about what was I missing ...and that it is ... Undecided

    Sunday, December 26, 2010 10:42 AM
  • hi vit100: I also faced this problem.

    each and every time when run the WCF Test Client it is dynamically create the config File and set the values to default.so if i change the value once it is not take effect when i run it again.

    only one movement it  increased the size of message. if i run it again then i faced same problem.

    can you tell me in more details how to solve this problem. i had spent lot of time with this error.

    thank you in advance.

    Friday, February 11, 2011 7:04 AM
  • Friday, February 11, 2011 2:15 PM
  • hi bsavoie,

    which one reply is answer for this problems. there are some sort of replies availabe.

    so can u give it in more details. how to got over from this problem.

    thanks for your last reply

    Monday, February 14, 2011 4:06 AM
  • Specifically, this post shows you how to alter the config file for the wcf test client. It works very well.

    http://msdn.microsoft.com/en-us/library/bb552364.aspx


    Monday, February 14, 2011 10:16 PM
  • Thanks for your reply bsavoie,

    in my WcfTestClient there are not available tools>options. so i confused by it.

    now i downloaded a new wcfTestClient tool and used it. it has the Tools menu. now the problems is over.

    Tuesday, February 15, 2011 1:18 AM
  • Hi vit100, You are really a genious! Don't know how did you come up with idea and trial thou, but this really saves my work. I've been banging my head for 3-days on this. Finally found your humble 'suggestion' that gets my uploading to WCF data service working with large file transfer. Just want to say thank you!

    Sunday, May 29, 2011 3:59 AM