内部异常抛出 [英] Inner exception throw

查看:67
本文介绍了内部异常抛出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试通过窗口服务获取数据时,出现以下错误.
(我正在从数据库中获取大约10000条记录.)

格式化程序尝试反序列化消息时引发异常:
尝试反序列化参数时发生错误
InnerException消息是在对象图中可以序列化或反序列化的最大项目数为65536;.更改对象图或增加MaxItemsInObjectGraph配额.有关更多详细信息,请参见InnerException.

请帮助我.

When I am trying to fetch the data through the window service I am getting the following error.
(I am fetching around 10000 records from the database.)

The formatter threw an exception while trying to deserialize the message:
There was an error while trying to deserialize parameter
The InnerException message was Maximum number of items that can be serialized or deserialized in an object graph is 65536;. Change the object graph or increase the MaxItemsInObjectGraph quota. Please see InnerException for more details.

Please help me.

推荐答案

您需要确保您返回的数据可以被序列化程序序列化.
尝试减少返回的记录数,以验证是否确实如此.

如果是大小问题,您可以尝试以下几种方法;您可以在绑定上调高消息有效负载的大小:
You need to make sure that the data you return can be serialized by the serializer.
Try reducing the count of records returned to verify that this is the case.

If it is a size issue there are a few things you can try; you can turn up the message payload size on the binding:
<binding name="MyBinding"

         ...

         maxBufferSize="10485760"

         maxReceivedMessageSize="10485760"



或者,您可以更改应用程序逻辑以读取块或页面中的记录.
如果可能的话,我会选择后者,因为它的伸缩性更好.

希望这会有所帮助,
Fredrik



Or you can change your application logic to read the records in chunks or pages.
I''d go for the latter if possible because it scales better.

Hope this helps,
Fredrik


该错误消息是不言自明的.您的对象图是什么样的?你有嵌套的对象吗?它们有多大?拥有10,000条记录,您可能有大量数据,并且超出了序列化程序的限制.
The error message is fairly self-explanatory. What does your object graph look like? Do you have nested objects? How large are they? With 10,000 records you probably have a lot of data and it is exceeding the limit of the serializer.


请确保对象的正确版本以及其CORRECT版本的所有部分都可以序列化类.我的意思是-好,您要序列化一个类的对象,然后修改该类,然后再加载原始类的对象.这可能会引发新的异常,就像您看到的那样.其次,需要考虑序列化的大小,如果您不使用IMAGES和其他BLOBS,那么1万条记录应该不会令人震惊.
Make sure that the object is serializable as well as all its parts with the CORRECT version of your classes. What do I mean -- well, you are serializing an object of a class and then you modify the class and then you want to load the object of the original class. This could throw new exceptions not unlike the one that you saw. Second, the size of the serialization needs to be considered, 10k records should not be shocking if you''re not using IMAGES and other BLOBS.


这篇关于内部异常抛出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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