WCF maxReceivedMessageSize not being read from config

后端 未结 3 1867
失恋的感觉
失恋的感觉 2020-12-15 20:43

I have a the following server side app.config for a WCF service:

  
    
      
        

        
相关标签:
3条回答
  • 2020-12-15 21:19

    If you're still getting this error message while using the WCF Test Client, it's because the client has a separate MaxBufferSize setting.

    To correct the issue:

    1. Right-Click on the Config File node at the bottom of the tree
    2. Select Edit with SvcConfigEditor

    A list of editable settings will appear, including MaxBufferSize.

    Note: Auto-generated proxy clients also set MaxBufferSize to 65536 by default.

    0 讨论(0)
  • 2020-12-15 21:22

    There's more settings :-) Try "maxBufferPoolSize" and "maxBufferSize" on the <binding> tag.

    But the biggest problem is: your endpoint does not reference that binding configuration!

    <endpoint address="" 
              binding="wsHttpBinding" contract="Core.TOAService.ITOAService">
    

    You need to add a reference to it so that it gets useful - just calling it "default" doesn't work.....

    <endpoint address="" 
              binding="wsHttpBinding" 
              bindingConfiguration="default"
              contract="Core.TOAService.ITOAService">
    

    You're ahead of your times ;-) In WCF 4 (with .NET 4.0 - sometime later this year 2009), you'll be able to define "default binding configurations" without having to explicitly name and reference them - but for now, you need to create a link between your endpoint and its binding and any binding (or behavior) configuration you have!

    Marc

    0 讨论(0)
  • 2020-12-15 21:25

    There are several places that you need to set the size. In your case I think that you need to add read quotas. Here is an example:

      <basicHttpBinding>
        <binding name="httpBasicBinding_Service" closeTimeout="00:03:00"
          openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00"
          maxBufferSize="2000001"
          maxBufferPoolSize="2000001" maxReceivedMessageSize="2000001">
          <readerQuotas maxDepth="2000001" maxStringContentLength="2000001"
            maxArrayLength="2000001" maxBytesPerRead="2000001" maxNameTableCharCount="2000001" />
        </binding>
      </basicHttpBinding>
    
    0 讨论(0)
提交回复
热议问题