我们在服务器上托管了一个WCF Rest Json服务,它使用本机iPad应用程序。大多数用户,它在调用WCF服务时工作正常。但对于一些用户,我们发现WCF接收到已损坏或剪切的Json字符串。 Json字符串的某些部分被剪切,无法从服务端反序列化。
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "UpdateDate/")]
[OperationContract]
CustomServiceResponse UpdateDate(Stream paymentUpdateModel);
以下是我们在取消剪裁剪辑的Json字符串时遇到的错误。
There was an error deserializing the object of type Model.PaymentModel. Unexpected end of file. Following elements are not closed: Message, root. -- at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader reader)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)
任何人都知道为什么Json字符串会被剪掉吗?