none
Save wav file in SQL CE RRS feed

  • Question

  • Hi,

    I am developing an application that records wav files, inserts them in a SQL Compact Edition database and then sends them back in SQL Server using Sync Framework for Devices. When I execute the Sync process I get a CFFaultException exception. Please note that the field in SQL Server is of type Image. Below is the code to save the wav file in the SQL Compact Edition database.

     

    FileStream fs = new FileStream(strTempWav, FileMode.Open, FileAccess.Read);
    byte[] buffer = new byte[fs.Length];
    fs.Read(buffer, 0, (int)fs.Length);
    fs.Close();
    fs = null;

    (ResultSetBindingSource.Current as RowView).UpdatableRecord.SetValue(0,buffer);

    Monday, September 12, 2011 7:02 PM

Answers

  • I changed the ReaderQuotas.MaxStringContentLength to int.MaxValue in GZipEncoder and my wav file was sent back to the server successfully.
    Tuesday, September 13, 2011 10:35 AM

All replies

  • can you post a more detailed stack trace of the error?
    Monday, September 12, 2011 11:37 PM
    Moderator
  • {<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
      <s:Header>
        <a:Action s:mustUnderstand="1">http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault</a:Action>
      </s:Header>
      <s:Body>
        <s:Fault>
          <s:Code>
            <s:Value>s:Receiver</s:Value>
            <s:Subcode>
              <s:Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</s:Value>
            </s:Subcode>
          </s:Code>
          <s:Reason>
            <s:Text xml:lang="el-GR">Error in deserializing body of request message for operation 'ApplyChanges'.</s:Text>
          </s:Reason>
          <s:Detail>
            <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
              <HelpLink i:nil="true" />
              <InnerException>
                <HelpLink i:nil="true" />
                <InnerException>
                  <HelpLink i:nil="true" />
                  <InnerException i:nil="true" />
                  <Message>The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 2, position 52572.</Message>
                  <StackTrace>   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
       at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
       at System.Data.DataTextReader.ReadString()
       at System.Data.XMLDiffLoader.ReadOldRowData(DataSet ds, DataTable&amp; table, Int32&amp; pos, XmlReader row)
       at System.Data.XMLDiffLoader.ProcessDiffs(DataSet ds, XmlReader ssync)
       at System.Data.XMLDiffLoader.LoadDiffGram(DataSet ds, XmlReader dataTextReader)
       at System.Data.DataSet.ReadXmlDiffgram(XmlReader reader)
       at System.Data.DataSet.ReadXml(XmlReader reader, XmlReadMode mode, Boolean denyResolving)
       at System.Data.DataSet.ReadXmlSerializable(XmlReader reader)
       at System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader reader)
       at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable, Boolean wrappedAny)
       at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIInfoTraderCacheSyncContract.Read22_ApplyChanges()
       at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer5.Deserialize(XmlSerializationReader reader)
       at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)</StackTrace>
                  <Type>System.Xml.XmlException</Type>
                </InnerException>
                <Message>There is an error in XML document (2, 52572).</Message>
                <StackTrace>   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
       at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
       at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)</StackTrace>
                <Type>System.InvalidOperationException</Type>
              </InnerException>
              <Message>Error in deserializing body of request message for operation 'ApplyChanges'.</Message>
              <StackTrace>   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc&amp; rpc)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
              <Type>System.ServiceModel.CommunicationException</Type>
            </ExceptionDetail>
          </s:Detail>
        </s:Fault>
      </s:Body>
    </s:Envelope>}
    Tuesday, September 13, 2011 9:07 AM
  • I changed the ReaderQuotas.MaxStringContentLength to int.MaxValue in GZipEncoder and my wav file was sent back to the server successfully.
    Tuesday, September 13, 2011 10:35 AM