Failed in WCF w/ the message:
The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
Then, using tha approach in
https://www.youtube.com/watch?v=7ediHIeIWrM[
^], I modified the config through the WCF Test Client's Editor, it works (see the config below).
="1.0"="utf-8"
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ITransInfo" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
<binding name="BasicHttpBinding_ITransInfoJson" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:35104/TransInfo.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_ITransInfo" contract="ITransInfo"
name="BasicHttpBinding_ITransInfo" />
<endpoint address="http://localhost:35104/TransInfo.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_ITransInfoJson" contract="ITransInfoJson"
name="BasicHttpBinding_ITransInfoJson" />
</client>
</system.serviceModel>
</configuration>
However, if I re-debug again, the Client.dll.config likes before, the default.config (the biding block is gone), which means the modified config was not saved actually. How can this problem be solved since I have to deploy it on my server? Or where is the default.config so I can modified it. Thanks.
*******
I also tried to dynamically setup the max. message size by the code below. But it does not work.
System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding("BasicHttpBinding_ITransInfo");
System.ServiceModel.BasicHttpBinding binding2 = new System.ServiceModel.BasicHttpBinding("BasicHttpBinding_ITransInfoJson");
binding.MaxBufferSize = 2147483647;
binding.MaxReceivedMessageSize= 2147483647;
binding.MaxBufferPoolSize = 2147483647;
binding2.MaxBufferSize = 2147483647;
binding2.MaxReceivedMessageSize = 2147483647;
binding2.MaxBufferPoolSize = 2147483647;
System.Xml.XmlDictionaryReaderQuotas myReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas();
myReaderQuotas.MaxStringContentLength = 2147483647;
myReaderQuotas.MaxNameTableCharCount = 2147483647;
myReaderQuotas.MaxArrayLength= 2147483647;
myReaderQuotas.MaxBytesPerRead= 2147483647;
myReaderQuotas.MaxDepth=64;
binding.GetType().GetProperty("ReaderQuotas").SetValue(binding, myReaderQuotas, null);
binding2.GetType().GetProperty("ReaderQuotas").SetValue(binding2, myReaderQuotas, null);