The max message size quota for incoming messages (65536) …To increase the quota, use the MaxReceivedMessageSize property

前端 未结 3 1410
粉色の甜心
粉色の甜心 2020-12-15 06:24

I got this crazy problem I\'m trying to deal with. I know that when we\'re getting huge amount of data we must increase the quota on client .config file, but what am I suppo

相关标签:
3条回答
  • 2020-12-15 06:29

    You can set the MaxReceivedMessageSize property on the service via the service's config file.

    Setting the client's MaxReceivedMessageSize only affects messages received by the client; it has no effect on messages received by the service. Correspondingly, to allow the service to receive large messages, you need to set the service's config file.

    Sample Service Config

    <system.serviceModel>
      <bindings>
        <wsHttpBinding>
          <binding name="MyBinding" maxReceivedMessageSize="2147483647" />
        </wsHttpBinding>
      </bindings>
      <services>
        <service name="MyService">
          <endpoint address="http://myservice" binding="wsHttpBinding"
                    bindingConfiguration="MyBinding" contract="IMyServiceContract" />
        </service>
      </services>
    </system.serviceModel>
    

    The above is a very stripped down config file, but shows the relevant parts. The important part is that you define the binding and give it a name, and set any values explicitly that are different from the defaults, and use that name in the bindingConfiguration attribute on the endpoint element.

    0 讨论(0)
  • 2020-12-15 06:35

    This issue can be resolved by adding the below additional binding node to the binding section of config file.

    <basicHttpBinding>
      <binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
           maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      </binding>
    </basicHttpBinding>
    
    0 讨论(0)
  • 2020-12-15 06:41

    My problem was with the wcf test client. For some reason, it wouldn't generate a client config with the increased maxReceivedMessageSize. My fix was to right click "Config file" -> "Edit with SvcConfigEditor" -> bindings -> maxReceivedMessageSize.

    0 讨论(0)
提交回复
热议问题