我的Wcf方法返回包含大约100000条记录的数据集。正文消息的大小约为30 Mb未压缩。 有时它工作正常,但很多时候我在反序列化操作期间收到以下xml异常:
对象System.Data.DataSet的反序列化期间出错。意外 文件结尾已经发生。以下元素未关闭: NumEffetto,Scadenze,NewDataSet,diffgram,GetChangesResult, GetChangesResponse,Body,Envelope。'
堆栈追踪:
在 System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader,PartInfo part,Boolean isRequest)in System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader,PartInfo part,Boolean isRequest)in System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader,MessageVersion版本,字符串操作,MessageDescription messageDescription,Object [] parameters,Boolean isRequest)in System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(消息 message,Object [] parameters,Boolean isRequest)in System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(消息 message,Object [] parameters)in System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc&安培; rpc)in System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime 操作,ProxyRpc& rpc)in System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway,ProxyOperationRuntime操作,Object [] ins, 对象[]出局,TimeSpan超时) System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime operation)in System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天 消息) System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培; Kronos.WCFSync.ISyncService.GetChanges(Int64中的msgData,Int32类型) clientCTVersion,Int64 verPubblicazione,SyncParam []参数)in Kronos.WCFSync.SyncServiceClient.GetChanges(Int64 clientCTVersion, Kronos.SyncManager.Sync()
中的Int64 verPub,SyncParam []参数)
答案 0 :(得分:0)
固定!问题是sendTimeout的默认值,在我的情况下它太低了(1分钟)。我在web.config中添加了Binding标记中的元素,现在它可以正常工作:
<binding name="customBinding"
closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00">
</binding>
答案 1 :(得分:-2)
检查你的web.config中是否有读者配额也改变了json中的ResponseFormat