简体   繁体   English

超过MaxStringContentLength?

[英]Over MaxStringContentLength?

I have some .asmx webservices, imported as service reference on .NET 4.5. 我有一些.asmx Web服务,作为.NET 4.5上的服务参考导入。

They download a XML string, and than I try to process it with XmlDocument . 他们下载了XML字符串,然后我尝试使用XmlDocument处理它。

Well, now I get this error: The maximum string content length quota (8192) has been exceeded while reading XML data. 好吧,现在我得到了这个错误: 读取XML数据时,已超出最大字符串内容长度配额(8192)。 This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader 通过更改在创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxStringContentLength属性,可以增加此配额。

How can I fix this trouble? 我该如何解决此问题? I am on Visual Studio 2010, tried this , but is WCF, I can't find that zone. 我在Visual Studio 2010上尝试过此操作 ,但在WCF中,我找不到该区域。

Tried adding this code before calling a function of the webservice: 尝试在调用Web服务的功能之前添加以下代码:

XmlDictionaryReaderQuotas myConf = new XmlDictionaryReaderQuotas();
myConf.MaxStringContentLength = 202400;

but nothing changes! 但是什么都没有改变!

You have to change the MaxStringContentLength from you configuration or when you create the binding. 您必须从配置中或在创建绑定时更改MaxStringContentLength。 Besides that it has to be the same on the server and client. 除此之外,它在服务器和客户端上必须相同。 If not you can send it, but not receive the content. 如果没有,您可以发送它,但不能接收内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM