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

前端 未结 8 1175
别那么骄傲
别那么骄傲 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 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;
    }
    

提交回复
热议问题