none
maxReceivedMessageSize is not working as expected RRS feed

  • Question

  • Hi,

    Greetings for the day.

    I have read in the msdn doc, as the maxReceivedMessageSize attribute mentions the maximum msg size that it can receive (which is to be mentioned in terms of bytes).

    I just set it to 10 and also the same for the maxBufferSize (= 10). This settings are done on the WCF Service and i have updated the client side service reference also.

    Case 1:

    In server side there is one function which accpets the string.  (Ex: void getMessage(string data))

    So from this docs understanding, the function have to receive exactly 10 characters (totally 10 bytes since 1char = 1byte).

    But i can able to send more than 10 characters to the wcf service , and also , it is received there in the wcf service and in the client there is no error or no exception raised.

    May i kindly know , have i misunderstood, or did something wrong and may i know, how should i make the code change, so the wcf server will throw error when receiving more than the mentioned size.

    Thanks in advance.


    NANDAKUMAR.T

    Friday, February 27, 2015 7:41 AM

All replies

  • Hi,

    Greetings for the day.

    In my WCF service, I am using the basicHttpBiding.

    From client, I want to send some string data to the WCF Service.

    I am having the binding configuration attributes with the largest value possible (2147483647).

    <binding name="TestService" 
             allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
             maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize ="2147483647"
             messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
             useDefaultWebProxy="true">
    
    	<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
                                    maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    
    </binding>

    While sending the string data copied from a file of size 91 KB it is throwing the error as request entity too large.

    And also, i have tried by replacing

     1.  transferMode from  Buffer to Stream mode and 

     2. messageEncoding fom the "Text" to "Mtom"

    But still, I cannot able to send the large string data to the wcf service.

    May I kindly know what I am missing and how to get it correct.

    Thanks in advance.


    NANDAKUMAR.T


    Friday, February 27, 2015 10:11 AM
  • Hi,

     How are you hosting this service? If it's hosted in IIS, you might want to check out the different knobs you can tweak in the IIS configuration related to message sizes as well.

     --larsw




    Friday, February 27, 2015 10:30 AM
    Moderator
  • Hi

    No. I am just running it like, normal application, and consuming it in my client.

    May i know , in this case how to get it.

    Thanks.


    NANDAKUMAR.T

    Friday, February 27, 2015 11:36 AM
  • But i can able to send more than 10 characters to the wcf service , and also , it is received there in the wcf service and in the client there is no error or no exception raised.

    That's because the WCF service side is setting at its default settings,  and you never overrode any settings on the service side, which can only be done by using a custom binding and pointing the service side configuration to the custom binding. The custom binding on the service side is where you set the maxreceivesize, buffersize, readerqouata and all of that, and you point to the custom binding.

    However, CB(s) do not apply to the client side, and you don't override settings with a custom binding on the client side, which are done directly.

    http://www.codeproject.com/Tips/243357/WCF-Custom-Binding

    Sunday, March 1, 2015 7:26 AM
  • Hi NANDAKUMAR T,

    I wonder if you have the binding configuration in both client and service side.

    Besides, please also try to make sure that you have applied the binding configuration in the endpoint as following:

     <endpoint 
          address="***" 
          binding="basicHttpBinding" 
          bindingConfiguration="TestService" 
          contract="***" />
     

    The following article may give you some idea, please try to check it:
    http://blogs.msdn.com/b/ryberry/archive/2010/04/20/transferring-large-blogs-of-data-with-wcf.aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 2, 2015 2:05 AM
    Moderator
  • Hi,

    I checked all those settings.

    But still no use.. And also, i have tried to go with CustomBinding. But still, the same issue is there.

    I have inherited from "BindingCollectionElement" and "Binding" as mentioned in the below mentioned article.

    (http://www.codeproject.com/Tips/243357/WCF-Custom-Binding)

    A part of my settings, is shown below:-

    <customBinding>
    	<binding name="iFaceSrvCustomBinding">
    		<httpTransport maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
    			maxReceivedMessageSize="2147483647" transferMode="Streamed">
    		</httpTransport>
    	    <textMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647"/>
    	</binding>
    </customBinding>
     
    <extensions>
    	<bindingExtensions>
    		<add name="iFaceSrvCustomBinding"
    		type="IFaceCDXService.CustomBinding.CustomBindingCollectionElement, CustomBinding"/>
    	</bindingExtensions>
    </extensions>
     
    <service name="IIFaceBMService">
    	<endpoint address="http://localhost:57712/IFaceBMService.svc"
    		bindingConfiguration ="iFaceSrvCustomBinding" binding="customBinding"
    		contract="IFaceSrvRef.IIFaceBMService" name="BasicHttpBinding_IIFaceBMService" />
    </service>

    May i know, where i went wrong and why i am not getting the result.

    Thanks in advance.


    NANDAKUMAR.T


    Monday, March 2, 2015 1:16 PM
  • Hi,

    I have updated the server settings and also i have followed the way, mentioned in the above codeproject article, but still no use.

    I have shown a part of settings as below.

    <customBinding>
    	<binding name="iFaceSrvCustomBinding">
    		<httpTransport maxBufferSize="10" maxBufferPoolSize="10"
    			maxReceivedMessageSize="10" transferMode="Streamed">
    		</httpTransport>
    	    <textMessageEncoding maxReadPoolSize="10" maxWritePoolSize="10"/>
    	</binding>
    </customBinding>
     
    <extensions>
    	<bindingExtensions>
    		<add name="iFaceSrvCustomBinding"
    		type="IFaceCDXService.CustomBinding.CustomBindingCollectionElement, CustomBinding"/>
    	</bindingExtensions>
    </extensions>
     
    <service name="IIFaceBMService">
    	<endpoint address="http://localhost:57712/IFaceBMService.svc"
    		bindingConfiguration ="iFaceSrvCustomBinding" binding="customBinding"
    		contract="IFaceSrvRef.IIFaceBMService" name="BasicHttpBinding_IIFaceBMService" />
    </service>

    But still i am receiving the same issue.

    Is there any other things to check.

    Thanks in advance.


    NANDAKUMAR.T

    Monday, March 2, 2015 1:23 PM
  • It has been a long time since I have used Custom Bindings. It should work for you, but someone else may need to step in and help.
    Monday, March 2, 2015 7:42 PM
  • staff

        If anyone needs more information, below.

    https://social.msdn.microsoft.com/Forums/pt-BR/ad2dfb81-6309-43f6-bd52-c091bf3ffacb/nfe-20-binding-erro-soap-header-action-was-not-understood?forum=webservicespt
    
    

    Tuesday, March 3, 2015 6:01 AM
  • Hi NANDAKUMAR T,

    Please try to set the timeout in the config file as well:

    closeTimeout="00:10:00" openTimeout="00:10:00" 
    receiveTimeout="00:10:00" sendTimeout="00:10:00"
    

    Besides, please try to make sure that you have applied the config in both client and service side.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 9, 2015 1:57 AM
    Moderator