WCF抛出异常 s:发件人 答:反序列化失败 格式化程序在尝试反序列化消息时引发异常:尝试反序列化参数时出错http://tempuri.org/:dataSet. InnerException消息为“反序列化System.Data.DataSet类型的对象时出错。”��http://tempuri.org/ISplSynchronizationContracts/ApplyChangesD' 包含无效的UTF8字节。“。有关更多详细信息,请参阅InnerException。 无法将索引0处的字节[82]从指定的代码页转换为Unicode。 位于System.Text.DecodeXceptionFallbackBuffer.Throw(字节[]bytesUnknown,Int32索引) 位于System.Text.DecodeXceptionFallbackBuffer.Fallback(字节[]bytesUnknown,Int32索引) 在System.Text.DecoderFallbackBuffer.InternalFallback(字节[]字节、字节*pBytes、字符*&;字符)

WCF抛出异常 s:发件人 答:反序列化失败 格式化程序在尝试反序列化消息时引发异常:尝试反序列化参数时出错http://tempuri.org/:dataSet. InnerException消息为“反序列化System.Data.DataSet类型的对象时出错。”��http://tempuri.org/ISplSynchronizationContracts/ApplyChangesD' 包含无效的UTF8字节。“。有关更多详细信息,请参阅InnerException。 无法将索引0处的字节[82]从指定的代码页转换为Unicode。 位于System.Text.DecodeXceptionFallbackBuffer.Throw(字节[]bytesUnknown,Int32索引) 位于System.Text.DecodeXceptionFallbackBuffer.Fallback(字节[]bytesUnknown,Int32索引) 在System.Text.DecoderFallbackBuffer.InternalFallback(字节[]字节、字节*pBytes、字符*&;字符),wcf,Wcf,我在WCF中使用自定义绑定,有时会出现上述错误。有人能帮我吗?异常包含文本:包含无效的UTF8字节 很难根据有限的上下文进行验证,但我会假设在某个地方,您正在序列化为UTF-16或其他格式,而服务在这方面失败了 确保所有要序列化的对象都使用UTF-8显式序列化。您的custum绑定在做什么?我使用Microsoft Ado.Net同步服务而不是WCF服务。数据集对象由同步服务在内部传输。 <s:Body> <s:Fault> <s:Code> &

我在WCF中使用自定义绑定,有时会出现上述错误。有人能帮我吗?

异常包含文本:
包含无效的UTF8字节

很难根据有限的上下文进行验证,但我会假设在某个地方,您正在序列化为UTF-16或其他格式,而服务在这方面失败了


确保所有要序列化的对象都使用UTF-8显式序列化。

您的custum绑定在做什么?我使用Microsoft Ado.Net同步服务而不是WCF服务。数据集对象由同步服务在内部传输。
 <s:Body>
<s:Fault>
  <s:Code>
    <s:Value>s:Sender</s:Value>
    <s:Subcode>
      <s:Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</s:Value>
    </s:Subcode>
  </s:Code>
  <s:Reason>
    <s:Text xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:dataSet. The InnerException message was 'There was an error deserializing the object of type System.Data.DataSet. '��&lt;http://tempuri.org/ISplSynchronizationContracts/ApplyChangesD&#x1A;' contains invalid UTF8 bytes.'.  Please see InnerException for more details.</s:Text>
  </s:Reason>
  <s:Detail>
    <ExceptionDetail xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel">
      <HelpLink i:nil="true" />
      <InnerException>
        <HelpLink i:nil="true" />
        <InnerException>
          <HelpLink i:nil="true" />
          <InnerException>
            <HelpLink i:nil="true" />
            <InnerException i:nil="true" />
            <Message>Unable to translate bytes [82] at index 0 from specified code page to Unicode.</Message>
            <StackTrace>   at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index)
   at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index)
   at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes, Char*&amp; chars)