wcf服务中的序列化异常

时间:2014-08-05 17:26:25

标签: .net wcf serialization

我们有一个包含一些方法的wcf服务,偶尔它会在尝试序列化数据时失败。例外情况如下(还包含堆栈跟踪)。

任何解决方案? 另外,为什么这种情况偶尔会偶尔发生?返回的数据始终保持不变。

[System.Text.EncoderFallbackException]:无法将索引1处的Unicode字符\ uDF98转换为指定的代码页。 调用堆栈:     在System.Text.EncoderExceptionFallbackBuffer.Fallback(System.Char charUnknown,System.Int32 index)[IL:0x2B] [Native:0xB7]     在System.Text.EncoderFallbackBuffer.InternalFallback(System.Char ch,System.Char *& chars)[IL:0xE7] [Native:0x125]     在System.Text.UTF8Encoding.GetBytes(System.Char * chars,System.Int32 charCount,System.Byte * bytes,System.Int32 byteCount,System.Text.EncoderNLS baseEncoder)[IL:0x21D] [Native:0xD93D94]     在System.Text.UTF8Encoding.GetBytes(System.Char * chars,System.Int32 charCount,System.Byte * bytes,System.Int32 byteCount)[IL:0x54] [Native:0x4C]     在System.Xml.XmlStreamNodeWriter.UnsafeGetUTF8Chars(System.Char * chars,System.Int32 charCount,System.Byte [] buffer,System.Int32 offset)[IL:0x80] [Native:0x263CC3]     在System.Xml.XmlBinaryNodeWriter.UnsafeWriteText(System.Char * chars,System.Int32 charCount)[IL:0x3C] [Native:0x8B]     在System.Xml.XmlBinaryNodeWriter.WriteText(System.String value)[IL:0x39] [Native:0x3C]     在System.Xml.XmlBaseWriter.WriteString(System.String value)[IL:0x4D] [Native:0x9E]     在System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteString(System.Runtime.Serialization.XmlWriterDelegator xmlWriter,System.String value,System.Xml.XmlDictionaryString name,System.Xml.XmlDictionaryString ns)[IL:0x29] [Native:0x53]     在WriteArrayOfstringToXml(System.Runtime.Serialization.XmlWriterDelegator,System.Object,System.Runtime.Serialization.XmlObjectSerializerWriteContext,System.Runtime.Serialization.CollectionDataContract)[Native:0xDC]