【发布时间】:2013-11-26 15:05:39
【问题描述】:
我正在实现一个分布式处理系统,其中客户端发送请求,参数是一个对象列表(序列化)和另一个双值。到服务器,服务器返回一个对象列表作为结果。我实现了服务器和客户端部分。
客户端部分:
BasicHttpBinding myBinding = new BasicHttpBinding();
myBinding.ReaderQuotas.MaxStringContentLength = Int32.MaxValue;
myBinding.MaxBufferSize = Int32.MaxValue;
myBinding.MaxReceivedMessageSize = Int32.MaxValue;
myBinding.ReaderQuotas.MaxArrayLength = Int32.MaxValue;
var myEndPoint = new EndpointAddress("http://172.20.54.168:6525/ServerObject");
var myChannelFactory = new ChannelFactory<MarchingCubesInterface>(myBinding, myEndPoint);
MarchingCubesInterface mc = null;
mc = myChannelFactory.CreateChannel();
在服务器端
BasicHttpBinding serviceBind = new BasicHttpBinding();
serviceBind.ReaderQuotas.MaxStringContentLength = Int32.MaxValue;
serviceBind.MaxBufferSize = Int32.MaxValue;
serviceBind.MaxReceivedMessageSize = Int32.MaxValue;
serviceBind.ReaderQuotas.MaxArrayLength = Int32.MaxValue;
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
host.Description.Behaviors.Add(smb);
对象正在序列化,但如果我尝试发送超过 4 个元素的序列化列表,它会显示读取 XML 数据时超出了最大字符串内容长度。我纯粹在纯代码基础上实现这一点(没有单独的配置文件)。有什么想法我犯了错误吗?
【问题讨论】: