none
The maximum message size quota for incoming messages (65536) has been exceeded

    Question

  • I am new to wcf. I wrote methods that return a string and it works well. Now I have a method that returns a dataset which is about 316 rows. I cannot get it to work. I have tried a lot  of things I found on this forum relating to my problem but still unable to get it to work. Not sure what is happening. Kinding assist.

    Here is my app.config file.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

      <configSections>
      </configSections>
      <system.web>
        <compilation debug="true" />
      </system.web>

      <connectionStrings>
        <add name="StudentService.Properties.Settings.Constr" connectionString="Data Source=ghy;Initial Catalog=yoyo;uid=dkjg; pwd=rugjg"
          providerName="System.Data.SqlClient" />
      </connectionStrings>
      <!-- When deploying the service library project, the content of the config file must be added to the host's
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="StudentServicesBinding" maxBufferSize="50000000" maxReceivedMessageSize="50000000" >
            </binding>   
          </basicHttpBinding>    
        </bindings>
        <client>
          <endpoint binding="basicHttpBinding" bindingConfiguration=""  contract="StudentService.IStudentService" />
        </client>
        <services>
          <service name="StudentService.StudentServices">      
            <endpoint address="StudentServices" binding="basicHttpBinding"  contract="StudentService.IStudentService" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />     
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8732/Design_Time_Addresses/StudentService/StudentServices/" />
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior >
              <!-- 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="False" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>

    </configuration>

     

    He

    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.

    Server stack trace:

       at System.ServiceModel.Channels.HttpInput.ThrowMaxReceivedMessageSizeExceeded()

       at System.ServiceModel.Channels.HttpInput.GetMessageBuffer()

       at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)

       at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)

       at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)

       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

       at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)

       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:

      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

       at IStudentService.GetFirstYearStudents(String start_session)

       at StudentServiceClient.GetFirstYearStudents(String start_session)

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

    re is the error message i have been receiving

     

     

     

     

    Friday, August 12, 2011 4:25 PM

All replies

  •  
    Well, if you changed the setting on the client side config and it blows,
    then the problem is on the service side with its config file.
     
    Look at "NewBindings" in this service side config to see how it's used
    to override the default value for a service.
     <bindings>
          <customBinding>
            <binding name="MessageBrokerSoap12">
              <textMessageEncoding maxReadPoolSize="64"
    maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8">
                <readerQuotas maxDepth="32"
    maxStringContentLength="2147483647" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              </textMessageEncoding>
              <httpTransport manualAddressing="false"
    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
    allowCookies="false" authenticationScheme="Anonymous"
    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
    keepAliveEnabled="true" maxBufferSize="65536"
    proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered"
    unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />
            </binding>
          </customBinding>
          <basicHttpBinding>
            <binding name="MessageBrokerSoap" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies="false" bypassProxyOnLocal="false"
    hostNameComparisonMode="StrongWildcard" maxBufferSize="65536"
    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
    useDefaultWebProxy="true">
              <readerQuotas maxDepth="32"
    maxStringContentLength="2147483647" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <security mode="None">
                <transport clientCredentialType="None"
    proxyCredentialType="None" realm="" />
                <message clientCredentialType="UserName"
    algorithmSuite="Default" />
              </security>
            </binding>
            <binding name="basicHttpBinding" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies="false" bypassProxyOnLocal="false"
    hostNameComparisonMode="StrongWildcard" maxBufferSize="65536"
    maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
    useDefaultWebProxy="true">
              <readerQuotas maxDepth="32"
    maxStringContentLength="2147483647" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <security mode="None">
                <transport clientCredentialType="None"
    proxyCredentialType="None" realm="" />
                <message clientCredentialType="UserName"
    algorithmSuite="Default" />
              </security>
            </binding>
            <binding name="NewBindingsMaxSizes"
    maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            </binding>
          </basicHttpBinding>
          <wsHttpBinding>
            <binding name="NewBindingsMaxSizes"
    maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            </binding>
            <binding name="NewBindingsMaxSizesNoSecurity"
    maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <security mode="None" />
            </binding>
            <binding name="TransactionBindingsMaxSizes"
    transactionFlow="true" maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <reliableSession ordered="true" inactivityTimeout="00:10:00"
    enabled="false" />
            </binding>
            <binding name="TransactionBindingsMaxSizesNoSecurity"
    transactionFlow="true" maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="64"
    maxStringContentLength="2147483647" maxArrayLength="2147483647"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <reliableSession ordered="true" inactivityTimeout="00:10:00"
    enabled="false" />
              <security mode="None" />
            </binding>
          </wsHttpBinding>
        </bindings>
        <services>
          <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.Community.CommunityBehavior"
    name="KN.Tiers.Services.App.BLL.Community.Community">
            <endpoint address="/wsSoap" binding="wsHttpBinding"
    bindingConfiguration="NewBindingsMaxSizesNoSecurity"
    contract="KN.Tiers.Services.App.BLL.Community.ServiceContracts.ICommunity">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="/BasicSoap" binding="basicHttpBinding"
    bindingConfiguration="NewBindingsMaxSizes" name="basicHttpBinding"
    contract="KN.Tiers.Services.App.BLL.Community.ServiceContracts.ICommunity"
    />
            <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
          </service>
          <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.Cloud.CloudManagerBehavior"
    name="KN.Tiers.Services.App.BLL.Cloud.CloudManager">
            <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="NewBindingsMaxSizes" name="CloudManager"
    contract="KN.Tiers.Services.App.BLL.Cloud.ServiceContracts.ICloudManager">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
          </service>
          <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.NetworkNow.NetworkNowManagerBehavior"
    name="KN.Tiers.Services.App.BLL.NetworkNow.NetworkNowManager">
            <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizesNoSecurity"
    name="NetworkNowManager"
    contract="KN.Tiers.Services.App.BLL.NetworkNow.ServiceContracts.INetworkNowManager">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add
    />
              </baseAddresses>
            </host>
          </service>
          <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.ActionItem.ActionItemManagerBehavior"
    name="KN.Tiers.Services.App.BLL.ActionItem.ActionItemManager">
            <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizesNoSecurity"
    name="ActionItemManager"
    contract="KN.Tiers.Services.App.BLL.ActionItem.IActionItemManager">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add
    />
              </baseAddresses>
            </host>
          </service>
          <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.Links.LinkManagerBehavior"
    name="KN.Tiers.Services.App.BLL.Links.LinkManager">
            <endpoint address="/wsSoap" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizes" name="LinkService"
    contract="KN.Tiers.Services.App.BLL.Links.ServiceContracts.ILinkManager">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="/BasicSoap" binding="basicHttpBinding"
    bindingConfiguration="NewBindingsMaxSizes" name="basicHttpBinding"
    contract="KN.Tiers.Services.App.BLL.Links.ServiceContracts.ILinkManager" />
            <endpoint address="mex" binding="mexHttpBinding"
    bindingConfiguration="" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add
              </baseAddresses>
            </host>
          </service>
          <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.Wiki.WikiManagerBehavior"
    name="KN.Tiers.Services.App.BLL.Wiki.WikiManager">
            <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizesNoSecurity"
    name="WikiManager"
    contract="KN.Tiers.Services.App.BLL.Wiki.ServiceContracts.IWikiManager">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add
              </baseAddresses>
            </host>
          </service>
          <service
    behaviorConfiguration="KN.Tiers.Services.App.BLL.LMS.LMSManagerBehavior"
    name="KN.Tiers.Services.App.BLL.LMS.LMSManager">
            <endpoint address="" binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizesNoSecurity"
    name="LMSManager"
    contract="KN.Tiers.Services.App.BLL.LMS.ServiceContracts.ILMSManager">
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding"
    contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior
    name="KN.Tiers.Services.App.BLL.Community.CommunityBehavior">
              <serviceThrottling maxConcurrentCalls="32"
    maxConcurrentSessions="32" maxConcurrentInstances="520" />
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <WCFErrorHandlingBehavior />
            </behavior>
            <behavior
    name="KN.Tiers.Services.App.BLL.NetworkNow.NetworkNowManagerBehavior">
              <serviceThrottling maxConcurrentCalls="32"
    maxConcurrentSessions="32" maxConcurrentInstances="520" />
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <WCFErrorHandlingBehavior />
            </behavior>
            <behavior
    name="KN.Tiers.Services.App.BLL.Cloud.CloudManagerBehavior">
              <serviceThrottling maxConcurrentCalls="32"
    maxConcurrentSessions="32" maxConcurrentInstances="520" />
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
              <WCFErrorHandlingBehavior />
            </behavior>
            <behavior
    name="KN.Tiers.Services.App.BLL.ActionItem.ActionItemManagerBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
            <behavior
    name="KN.Tiers.Services.App.BLL.Links.LinkManagerBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
              <WCFErrorHandlingBehavior />
            </behavior>
            <behavior
    name="KN.Tiers.Services.App.BLL.Wiki.WikiManagerBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
              <WCFErrorHandlingBehavior />
            </behavior>
            <behavior name="KN.Tiers.Services.App.BLL.LMS.LMSManagerBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
              <WCFErrorHandlingBehavior />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <client>
          <endpoint
    binding="basicHttpBinding" bindingConfiguration="MessageBrokerSoap"
    contract="MessageBrokerReference.MessageBrokerSoap"
    name="MessageBrokerSoap" />
          <endpoint
    binding="customBinding" bindingConfiguration="MessageBrokerSoap12"
    contract="MessageBrokerReference.MessageBrokerSoap"
    name="MessageBrokerSoap12" />
          <endpoint
    binding="wsHttpBinding"
    bindingConfiguration="TransactionBindingsMaxSizes"
    contract="LinkManagerReference.ILinkManager" name="LinkService">
            <identity>
              <dns value="localhost" />
            </identity>
          </endpoint>
          <endpoint
    binding="basicHttpBinding" bindingConfiguration="basicHttpBinding"
    contract="LinkManagerReference.ILinkManager" name="basicHttpBinding" />
        </client>
      </system.serviceModel>
      <applicationSettings>
        <KN.Tiers.Services.Properties.Settings>
          <setting
    name="KN_Tiers_Community_ConfigManagerReference_ConfigManager"
    serializeAs="String">
          </setting>
        </KN.Tiers.Services.Properties.Settings>
      </applicationSettings>
    </configuration>
     
    Friday, August 12, 2011 5:23 PM
  • Hello,

    As explained above, please make sure that the maxReceivedMessageSize is set to a heigher value both on client and server side.If it does not work please set maxItemsInObjectGraph to a heigher value on server side. This can be set in the using datacontractserializer behavior as shown below:

    <dataContractSerializer maxItemsInObjectGraph=50000000/>

    Cheers!!

    • Proposed as answer by Paul3654 Tuesday, August 16, 2011 2:45 PM
    Saturday, August 13, 2011 2:38 AM
  • Thanks. Tried a couple of things and still not working.
    Sirdots
    Tuesday, August 16, 2011 2:47 PM