Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF XmlDictionaryReaderQuotas doesn't exist

Tags:

c#

wcf

I want to set maxArrayLength in basichtttpbiding. But the only way to do this, with out configuration file, is to create a XmlDictionaryReaderQuotas, that doesnt not exsist in System.xml, and put it in BasicHttpBinding1.ReaderQuotas.

What can I do to set the maxArrayLength with out using configuration file ?

EDIT:

I cant do that: basichtttpbiding1.ReaderQuotas.MaxArrayLength = 1000000; becouse I dont have any options to choose after this: basichtttpbiding1.ReaderQuotas.[Options to choose]

like image 655
Stav Alfi Avatar asked May 26 '12 13:05

Stav Alfi


2 Answers

Solved.

Need to add manually the reference: System.Runtime.Serialization and then the class XmlDictionaryReaderQuotas will be showen in System.Xml

like image 118
Stav Alfi Avatar answered Nov 10 '22 02:11

Stav Alfi


You don't need to create an instance of XmlDictionaryReaderQuotas. The binding already has one such instance, so you can use it directly:

BasicHttpBinding bhb = new BasicHttpBinding;
bhb.ReaderQuotas.MaxArrayLength = 1000000;

If you're in a platform such as Silverlight, however (and if it's the case, please add the appropriate tag in your question), this property isn't exposed. That's because this quota isn't enforced in that platform - it's essentially the same behavior as if the quota existed, but it was set to the maximum value (int.MaxValue). So you don't need to increase it (it's already max'd out), and you can't decrease it.

like image 21
carlosfigueira Avatar answered Nov 10 '22 03:11

carlosfigueira