【问题标题】:Wcf: exception during deserialization operationWcf:反序列化操作期间的异常
【发布时间】:2017-02-06 09:55:20
【问题描述】:

我有一个 Wcf 方法,它返回一个包含大约 100000 条记录的数据集。正文消息的大小约为 30 Mb 未压缩。 有时它工作正常,但很多时候我在反序列化操作期间收到以下 xml 异常:

对象 System.Data.DataSet 反序列化期间出错。意外 文件结束。以下元素未关闭: NumEffetto, Scadenze, NewDataSet, diffgram, GetChangesResult, GetChangesResponse、正文、信封。'

堆栈跟踪:

在 System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader 阅读器,PartInfo 部分,布尔 isRequest)在 System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader 阅读器,PartInfo 部分,布尔 isRequest)在 System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader 阅读器、MessageVersion 版本、字符串操作、MessageDescription messageDescription, Object[] 参数, Boolean isRequest) in System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(消息 消息,Object[] 参数,布尔 isRequest) 在 System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(消息 消息,Object[] 参数)在 System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& RPC)在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime 操作,ProxyRpc& rpc) 中 System.ServiceModel.Channels.ServiceChannel.Call(字符串动作, Boolean oneway, ProxyOperationRuntime 操作, Object[] ins, Object[] outs, TimeSpan timeout) in System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall、ProxyOperationRuntime 操作)中 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息)在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(消息数据& msgData,Int32 类型)在 Kronos.WCFSync.ISyncService.GetChanges(Int64 clientCTVersion, Int64 verPubblicazione, SyncParam[] 参数)在 Kronos.WCFSync.SyncServiceClient.GetChanges(Int64 clientCTVersion, Int64 verPub, SyncParam[] 参数)在 Kronos.SyncManager.Sync()

【问题讨论】:

    标签: .net wcf serialization


    【解决方案1】:

    已修复!问题是 sendTimeout 默认值,在我的情况下(1 分钟)太低了。我在 Binding 标签中的 web.config 中添加了以下元素,现在它可以正常工作了:

    <binding name="customBinding"
        closeTimeout="00:01:00" openTimeout="00:01:00" 
        receiveTimeout="00:10:00" sendTimeout="00:10:00">
    </binding>
    

    【讨论】:

      【解决方案2】:

      检查您的 web.config 中是否存在阅读器配额,同时更改 json 中的 ResponseFormat

      【讨论】:

      • 你怎么知道这是一个webHttpBinding服务?如果没有,那么 json 不是一个选项。此外,在任何错误中,readerQuotas 违规都非常明显。这显然不是由这个/引起的。
      猜你喜欢
      • 2013-02-07
      • 1970-01-01
      • 2017-06-12
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多