locked
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. - did that no change RRS feed

  • Question

  • First of all, thanks in advance to anyone who replies... I am new to WCF...

     

    I have a .net 3.5 c# command line utility trying to consume a WCF service I have hosted in iis...

    The command line utility reads a file into a string, and should send that string to my WCF service...  The string is about .5 of a meg.  Note the call works when the string is "Hello World"  I have increased the MaxReceivedMessageSize, maxBufferSize, maxBufferPoolSize, maxStringContentLength, maxArrayLength, maxBytesPerRead, maxNameTableCharCount... verified that the Security mode = none, and set <dataContractSerializer maxItemsInObjectGraph="6553600"/>... I have tried to check the http stack in fiddler... I see a 400 right away, no 202 or 200 just a 400...

    Can anyone think of anything I have missed, or suggest things I should try... I have enabled the WCF traceing, and the exact error I am getting is:

    Exception Type:System.ServiceModel.ProtocolException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

    Message: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.

    Stack Trace:

    System.ServiceModel.Channels.HttpInput.ThrowHttpProtocolException(String message, HttpStatusCode statusCode, String statusDescription)
    System.ServiceModel.Channels.HttpInput.ThrowMaxReceivedMessageSizeExceeded()
    System.ServiceModel.Channels.HttpInput.GetMessageBuffer()
    System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
    System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception&amp; requestException)
    System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
    System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, ItemDequeuedCallback callback)
    System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
    System.ServiceModel.PartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)
    System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()
    System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke()
    System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks()
    System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)
    System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
    System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
    System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
    
    the relevant web.config snipits from the service are:

     

    <system.serviceModel>
    		<bindings>
       <basicHttpBinding>
         <binding name="builderbasicHttpBinding" receiveTimeout="01:00:00"
          sendTimeout="01:00:00" useDefaultWebProxy="true" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
           <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
           <security mode="None"/>
         </binding>
       </basicHttpBinding>
      </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
      <services>
       <service behaviorConfiguration="Builder.Helper.WCF.UtilityBehavior"
        name="Builder.Helper.WCF.Utility">
        <endpoint address="" binding="basicHttpContextBinding" bindingConfiguration=""
         contract="Builder.Helper.WCF.IUtility">
         <identity>
          <dns value="Development" />
         </identity>
        </endpoint>
        <endpoint address="mex" binding="basicHttpBinding" contract="IMetadataExchange" />
       </service>
      </services>
    		<behaviors>
    			<serviceBehaviors>
    				<behavior name="Builder.Helper.WCF.UtilityBehavior">
    					<!-- 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="6553600"/>
    				</behavior>
    			</serviceBehaviors>
    		</behaviors>
    	</system.serviceModel>

     

    The App.config from client calling program is :

     

     

    <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpContextBinding_IUtility" closeTimeout="01:00:00"
                        openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
                        allowCookies="true" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                        maxReceivedMessageSize="2147483647" messageEncoding="Text"
                        textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                        <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                        <security mode="None">
                            <transport clientCredentialType="None" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="UserName" algorithmSuite="Default" />
                        </security>
                    </binding>
                </basicHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://Development:4246/Utility.svc" binding="basicHttpBinding"
                    bindingConfiguration="BasicHttpContextBinding_IUtility" contract="UtilitySvcRef.IUtility"
                    name="BasicHttpContextBinding_IUtility" />
            </client>
        </system.serviceModel>

     

     

     

    Thursday, April 1, 2010 6:40 PM

Answers

  • Hi, seems like you added the binding configuration but didn't specify it in the binding - it should be bindingConfiguration="builderbasicHttpBinding" whic is the reason why the bumped up quotas are not taking effect.

    - Piyush
    Thursday, April 1, 2010 7:15 PM

All replies

  • Hi, seems like you added the binding configuration but didn't specify it in the binding - it should be bindingConfiguration="builderbasicHttpBinding" whic is the reason why the bumped up quotas are not taking effect.

    - Piyush
    Thursday, April 1, 2010 7:15 PM
  • I think you are on the right track, the error is replaced with this one when I change that:

    The binding at system.serviceModel/bindings/basicHttpContextBinding does not have a configured binding named 'builderbasicHttpBinding'. This is an invalid value for bindingConfiguration. (C:\Development\trunk\CAVATICA\AutomatedBuilds\Builder\Builder.Helper.WCF\web.config line 151)

    but I think I do... web config of the wcf service that is hosted in iis (where I made the change):

    	<system.serviceModel>
    		<bindings>
       <basicHttpBinding>
         <binding name="builderbasicHttpBinding" receiveTimeout="01:00:00"
          sendTimeout="01:00:00" useDefaultWebProxy="true" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647">
           <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
           <security mode="None"/>
         </binding>
       </basicHttpBinding>
      </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
      <services>
       <service behaviorConfiguration="Builder.Helper.WCF.UtilityBehavior"
        name="Builder.Helper.WCF.Utility">
        <endpoint address="" binding="basicHttpContextBinding" bindingConfiguration="builderbasicHttpBinding" contract="Builder.Helper.WCF.IUtility">
         <identity>
          <dns value="Development" />
         </identity>
        </endpoint>
        <endpoint address="mex" binding="basicHttpBinding" bindingConfiguration="builderbasicHttpBinding" contract="IMetadataExchange" />
       </service>
      </services>
    		<behaviors>
    			<serviceBehaviors>
    				<behavior name="Builder.Helper.WCF.UtilityBehavior">
    					<!-- 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="6553600"/>
    				</behavior>
    			</serviceBehaviors>
    		</behaviors>
    	</system.serviceModel>

     

     

    Thursday, April 1, 2010 8:33 PM
  • Sorry found the issue in my implementation of the fix:

    <
    endpoint
     address
    =
    "
    " binding="basicHttpContextBinding
    "
     bindingConfiguration
    =
    "
    builderbasicHttpBinding
    "
     contract
    =
    "
    Builder.Helper.WCF.IUtility
    "
    >
    

    Should be :

    < endpoint address = " " binding="basicHttpBinding " bindingConfiguration = " builderbasicHttpBinding " contract = " Builder.Helper.WCF.IUtility " >

     

     

    Thanks Piyush,  your fix worked!

    -Deva

    Thursday, April 1, 2010 8:43 PM