I do not know how to create a WCF client in code with CustomBinding that has readerQuotas changed to larger value... I have attached a code snippet to show what I am trying to do. When I try to build the project, it says that the readerQuotas property is read-only. I have to create the client with code, I have to provide an assembly that does not need any .config files and has everything included in the assembly.
Can anyone help and give a working code sample ???
CustomBinding custBind = new CustomBinding();
BindingElementCollection bindElemColl = newBindingElementCollection();
BinaryMessageEncodingBindingElement bindElem = new BinaryMessageEncodingBindingElement();
bindElem.MaxReadPoolSize = 64;
bindElem.MaxWritePoolSize = 16;
bindElem.MaxSessionSize = 2048;
XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
readerQuotas.MaxDepth = 32;
readerQuotas.MaxStringContentLength = largeValue;
readerQuotas.MaxArrayLength = 16384;
readerQuotas.MaxBytesPerRead = 4096;
readerQuotas.MaxNameTableCharCount = 16384;
bindElemColl.ReaderQuotas = readerQuotas;
LAST LINE GIVES ERROR: Error 5 Property or indexer 'System.ServiceModel.Channels.BinaryMessageEncodingBindingElement.ReaderQuotas' cannot be assigned to -- it is read only