WCF服务中从客户端到服务器端的大数据传递问题 [英] the problem of large data delivery from client to server side in WCF service

查看:129
本文介绍了WCF服务中从客户端到服务器端的大数据传递问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了将大量数据从服务器传递到客户端的问题,我修改了一些属性值,问题得以解决,代码如下:

I had come across the problem of pass large data from server to client side, I modified some property values, the problem is resolved, the code is as follows:

NetTcpBinding bind = new NetTcpBinding(SecurityMode.None);
             bind.MaxReceivedMessageSize = 2147483647;
             bind.ReaderQuotas.MaxArrayLength = 2147483647;
             bind.ReaderQuotas.MaxBytesPerRead = 2147483647;
             bind.ReaderQuotas.MaxStringContentLength = 2147483647;
             bind.ReaderQuotas.MaxNameTableCharCount = 2147483647;
             bind.MaxBufferPoolSize = 2147483647;
             bind.MaxBufferSize = 2147483647;
             bind.ListenBacklog = 2147483647;



现在的问题是,我具有WCF更新数据库的功能,如下所示:



The question now is, I have a WCF function of updating the database, as follows:

[OperationContract]
void SaveDataTableWithDataAdapter(DataTable dt);



当我从客户端传递的DataTable的数据不是很大时,WCF会很好地工作.但是,当我的DataTable具有更多数据(例如1000条记录左右)时,WCF就会出错.为了解决这个问题,我认为我必须修改WCF传入数据包的最大允许长度,但是我不知道要在哪里更改.请帮忙!非常感谢! :((<



When data of the DataTable I pass from client side is not very large, WCF works well. But when my DataTable has more data (such as 1000 records or so), WCF goes wrong. To solve this problem, I think I have to modify the maximum allow length of incoming packets of WCF , but I do not know where to change. Please help! Many thanks! :((

推荐答案

您不需要修改最大长度,您需要修改设计.1000多个行是荒谬的.减少行数,对它们进行分块或使用其他类型的对象来序列化和传输所需的数据.
You don''t need to modify the max length, you need to modify your design. 1000+ rows is ridiculous. Reduce the number of rows, chunk them, or use a different type of object to serialize and transport the data necessary.


这篇关于WCF服务中从客户端到服务器端的大数据传递问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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