最大字符数 [英] Maximum number of characters

查看:183
本文介绍了最大字符数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





在我的WCF应用程序中,最大字符数允许id变为8012.How如何增加它?



我收到以下错误



格式化程序在尝试反序列化消息时抛出异常:尝试反序列化参数时出错http://tempuri.org/:_objProducts。 InnerException消息是''反序列化SysInterfaceML.Management.ProductsML类型的对象时出错。读取XML数据时已超出最大字符串内容长度配额(8192)。通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象的MaxStringContentLength属性,可以增加此配额。第326行,第77位。''。有关详细信息,请参阅InnerException。

Hi,

In my WCF application the maximum number of characters allowed id becoming 8012.How can i increase it?

I am getting the following error

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:_objProducts. The InnerException message was ''There was an error deserializing the object of type SysInterfaceML.Management.ProductsML. 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. Line 326, position 77.''. Please see InnerException for more details.

推荐答案

首先更改
I would start here:
maxReceivedMessageSize="65536"


它不能在配置文件中设置。你必须以编程方式设置通过



创建一个 XmlDictionaryReaderQuotas 对象和将maxium值设置为all。并将此对象应用于绑定并调用代理



示例代码为: -

It cant be set in the configuration file.you have to set in via programmatically

create an XmlDictionaryReaderQuotas object and set maxium value to all.and apply this object to your binding and call the proxy

sample code is:-
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
           EndpointAddress endPoint = new EndpointAddress(URI of your wcf);
           basicHttpBinding.MaxBufferSize = int.Parse("2147483647");
           basicHttpBinding.MaxReceivedMessageSize = int.Parse("2147483647");
           XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
           readerQuotas.MaxStringContentLength = int.Parse("2147483647");
           readerQuotas.MaxArrayLength = int.Parse("2147483647");
           basicHttpBinding.ReaderQuotas = readerQuotas;
           using (your proxy client= new  your proxy Client(basicHttpBinding, endPoint))
           {
               client.Open();
               success = client.your wcf function();
           }


通过修改Web.config文件中的maxReceivedMessageSize来接受大邮件,可以解决此问题。



By modifying the "maxReceivedMessageSize" in the Web.config file to accept large messages, you can solve this issue.

<system.servicemodel>
  <bindings>
    <basichttpbinding>
      <binding maxreceivedmessagesize="10485760">
        <readerquotas ...="" />
      </binding>
    </basichttpbinding>
  </bindings>  
</system.servicemodel>





http://tharakaweb.com/2012/12/11/413-热曲est-entity-too-large / [ ^ ]


这篇关于最大字符数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆