Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Also to be noted, is that the following properties of the Binding also need to be updated for the complete solution:</p> <pre><code>binding2.MaxBufferSize = 2147483647; binding2.MaxReceivedMessageSize = 2147483647; </code></pre> <p>For the benefit of others here is a sample that programmatically sets the ReaderQuotas on both the client and the server along with the 2 properties above:</p> <p>Client code:</p> <pre><code> WebHttpBinding binding2 = new WebHttpBinding(); XmlDictionaryReaderQuotas myReaderQuotas = new XmlDictionaryReaderQuotas(); myReaderQuotas.MaxStringContentLength = 2147483647; myReaderQuotas.MaxArrayLength = 2147483647; myReaderQuotas.MaxBytesPerRead = 2147483647; myReaderQuotas.MaxDepth = 2147483647; myReaderQuotas.MaxNameTableCharCount = 2147483647; binding2.GetType().GetProperty("ReaderQuotas").SetValue(binding2, myReaderQuotas, null); binding2.MaxBufferSize = 2147483647; binding2.MaxReceivedMessageSize = 2147483647; ServiceEndpoint ep = new ServiceEndpoint(ContractDescription.GetContract(typeof(IMyService)), binding2, new EndpointAddress("http://localhost:9000/MyService")); WebChannelFactory&lt;IMyService&gt; cf2 = new WebChannelFactory&lt;IMyService&gt;(ep); IMyService serv = cf2.CreateChannel(); serv.PrintNameDesc("Ram", new string('a', 100*1024*1024)); </code></pre> <p>Server code:</p> <pre><code> WebHttpBinding binding2 = new WebHttpBinding(); XmlDictionaryReaderQuotas myReaderQuotas = new XmlDictionaryReaderQuotas(); myReaderQuotas.MaxStringContentLength = 2147483647; myReaderQuotas.MaxArrayLength = 2147483647; myReaderQuotas.MaxBytesPerRead = 2147483647; myReaderQuotas.MaxDepth = 2147483647; myReaderQuotas.MaxNameTableCharCount = 2147483647; binding2.GetType().GetProperty("ReaderQuotas").SetValue(binding2, myReaderQuotas, null); binding2.MaxBufferSize = 2147483647; binding2.MaxReceivedMessageSize = 2147483647; WebServiceHost host2 = new WebServiceHost(typeof(MyService)); host2.AddServiceEndpoint(typeof(IMyService), binding2, new Uri("http://localhost:9000/MyService")); host2.Open(); </code></pre> <p>Where the contract is:</p> <pre><code>[ServiceContract] public interface IMyService { [WebInvoke(Method = "PUT", UriTemplate = "My/{name}/", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)] [OperationContract] void PrintNameDesc(string name, string desc); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload