wcf如何修改 MaxArrayLength 属性(不使用配置文件)

pnwilson 2013-11-29 11:21:36
之前做了个WCF运作良好,现在要做一个简单的传输,局域网,数据量大,结果MaxArrayLength属性太小,怎么改大?不使用配置文件。以前用了自定义绑定,是可以的,但我想再简化,如何处理?
EndpointAddress address = new EndpointAddress(string.Format("net.tcp://{0}:{1}/ScreenServerLib/Server/", SvrAddress, SvrPort));

ICollection<BindingElement> bindingElements = new List<BindingElement>();
TcpTransportBindingElement tcpBindingElement = new TcpTransportBindingElement();
----这里怎么写?
bindingElements.Add(tcpBindingElement);
tcpBindingElement.MaxReceivedMessageSize = int.MaxValue;
CustomBinding bind = new CustomBinding(bindingElements);

sClient = new ServiceReference1.ServerClient(bind, address);
...全文
111 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
pnwilson 2013-11-29
  • 打赏
  • 举报
回复
NetTcpBinding 与TcpTransportBindingElement 有何不同?我看了NetTcpBinding 是可以。

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧