问题描述
我遇到了将大量数据从服务器传递到客户端的问题,我修改了一些属性值,问题得以解决,代码如下:
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! :((
推荐答案
这篇关于WCF服务中从客户端到服务器端的大数据传递问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!