The maximum message size quota for incoming messages (65536) has been exceeded

前端 未结 8 1149
别那么骄傲
别那么骄傲 2020-11-30 04:36

I get this exception while creating scope for few tables all those tables are huge in design


    
        

        
相关标签:
8条回答
  • 2020-11-30 04:59

    For me, the settings in web.config / app.config were ignored. I ended up creating my binding manually, which solved the issue for me:

    var httpBinding = new BasicHttpBinding()
    {
        MaxBufferPoolSize = Int32.MaxValue,
        MaxBufferSize = Int32.MaxValue,
        MaxReceivedMessageSize = Int32.MaxValue,
        ReaderQuotas = new XmlDictionaryReaderQuotas()
        {
            MaxArrayLength = 200000000,
            MaxDepth = 32,
            MaxStringContentLength = 200000000
        }
    };
    
    0 讨论(0)
  • 2020-11-30 05:01

    You also need to increase maxBufferSize. Also note that you might need to increase the readerQuotas.

    0 讨论(0)
  • 2020-11-30 05:06

    You need to make the changes in the binding configuration (in the app.config file) on the SERVER and the CLIENT, or it will not take effect.

    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding maxReceivedMessageSize="2147483647 " max...=... />
            </basicHttpBinding>
           </bindings>
    </system.serviceModel>
    
    0 讨论(0)
  • 2020-11-30 05:09

    As per this question's answer

    You will want something like this:

    <bindings>
         <basicHttpBinding>
             <binding name="basicHttp" allowCookies="true"
     maxReceivedMessageSize="20000000"
     maxBufferSize="20000000"
     maxBufferPoolSize="20000000">
                 <readerQuotas maxDepth="32"
     maxArrayLength="200000000"
     maxStringContentLength="200000000"/>
             </binding>
         </basicHttpBinding> </bindings>
    

    Please also read comments to the accepted answer there, those contain valuable input.

    0 讨论(0)
  • 2020-11-30 05:10

    Updating the config didn't work for me, but I was able to edit the binding programmatically:

    private YourAPIClient GetClient()
    {
        Uri baseAddress = new Uri(APIURL);
    
        var binding = new BasicHttpBinding();
        binding.MaxReceivedMessageSize = 20000000;
        binding.MaxBufferSize = 20000000;
        binding.MaxBufferPoolSize = 20000000;
        binding.AllowCookies = true;
    
        var readerQuotas = new XmlDictionaryReaderQuotas();
        readerQuotas.MaxArrayLength = 20000000;
        readerQuotas.MaxStringContentLength = 20000000;
        readerQuotas.MaxDepth = 32;
        binding.ReaderQuotas = readerQuotas;
    
        if (baseAddress.Scheme.ToLower() == "https")
            binding.Security.Mode = BasicHttpSecurityMode.Transport;
    
        var client = new YourAPIClient(binding, new EndpointAddress(baseAddress));
        return client;
    }
    
    0 讨论(0)
  • 2020-11-30 05:10

    This worked for me:

     Dim binding As New WebHttpBinding(WebHttpSecurityMode.Transport)
     binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None
     binding.MaxBufferSize = Integer.MaxValue
     binding.MaxReceivedMessageSize = Integer.MaxValue
     binding.MaxBufferPoolSize = Integer.MaxValue
    
    0 讨论(0)
提交回复
热议问题