Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"maximum string content length quota (8192) has been exceeded while reading XML data" calling WCF via mexAddress moniker

Tags:

asp.net

wcf

I'm attempting to call a WCF service via mex from a classic ASP page. I've got the call working using the details on MSDN, but if I pass back an amount of data exceeding 8K I get an exception stating:

The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader...

The fix for this is easy enough in .NET client: you can adjust the client config to having a binding with a readerQuotas section including an increased quota. However, since I'm building a service moniker to pass to a GetObject call within ASP, I don't have access to a config to edit. If it were a VB6 app, I could use dllhost.exe.config, but that's not the case. The bindingConfiguration node (and sub nodes) don't appear to be parameters I can set within the moniker string.

Any ideas on how I could influence this parameter within the ASP context? ASP snippet with moniker string referenced below:

   Dim strXml, moniker, objProxy

   moniker="service:mexAddress='http://localhost/SomeApp/SomeServices/SomeService.svc/mex', "
   moniker=moniker + "address='http://localhost/SomeApp/SomeServices/SomeService.svc',"
   moniker=moniker + "contract=ISomeService, contractNamespace=http://foo.com, "
   moniker=moniker + "binding=WSHttpBinding_ISomeService, bindingNamespace=http://foo.com"

   Set objProxy = GetObject(moniker)

   strXml = objProxy.DoWork("foo", "bar")

Thanks!

like image 926
Thermite Avatar asked Jun 17 '09 18:06

Thermite


1 Answers

Try setting your maxStringContentLength in your wcf binding configuration on the server side.

like image 134
Shiraz Bhaiji Avatar answered Oct 20 '22 18:10

Shiraz Bhaiji