Search code examples
c#xmlwso2service-reference

How to set transferMode to streamed in a Windows Form App?


I keep getting "The maximum message size quota for incoming messages (65536) has been exceeded." error. My program references a service from a WSO2. Basically, the program sends 3 input parameters and receives the results from a sql query. At this point i just save the result in a dataGridView. A combination of 3 input characters return from the SR a list of 7 rows. Good. That's the correct result. It works. It just does. The other two combinations tho have 1000-2000 rows to return, and i keep getting that error.

I have no way to change the WSO2 configuration. The SR, however, does, presumably, allow for streamed data transfer.

I'm no web guy, and not that much of a programmer. Most solutions i've seen and was able to comprehance where suggesting to add maxReceivedMessageSize/transferMode to the app config. Didn't worked out for me. This is the original app.config that Visual Studio auto generates when adding the SR.

    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
        <binding name="aName">
           <security mode="aWord" />    
        </binding>
                <binding name="aName" />
            </basicHttpBinding>
            <customBinding>
                <binding name="anotherName" >
                  <textMessageEncoding messageVersion="Soap12" />
                  <httpsTransport />
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="theAdress"
                binding="basicHttpBinding" bindingConfiguration="aName"
                contract="aNamePortType" name="EndpointName" />
         <// some other endpoints/>
        </client>
    </system.serviceModel>

Here is what i tried to add and nothing changed.

    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
        <binding name="aName" maxReceivedMessageSize="67108864" transferMode="Streamed">
           <security mode="aWord" />    
        </binding>
                <binding name="aName" />
            </basicHttpBinding>
            <customBinding>
                <binding name="anotherName" >
                  <textMessageEncoding messageVersion="Soap12" />
                  <httpsTransport transferMode="Streamed" maxReceivedMessageSize="67108864"/>
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="theAdress"
                binding="basicHttpBinding" bindingConfiguration="aName"
                contract="aNamePortType" name="EndpointName" />
         <// some other endpoints/>
        </client>
    </system.serviceModel>

Well, not only those two. Tried the Int32.Max value, tried through code, tried without streamed. I have as much as no clue how can i solve this issue.


Solution

  • For the love of the way, i just had to... set useDefaultWebProxy to false for my binding, ... well, also making the allowed size bigger. You there, yes yes, you, reading this. Of what useDefaultWebProxy i'm talking about? Well, i'm glad you asked. Right click on App.config -> Edit WFC Configuration -> [select your binding] -> do thy magic.