SQL Server Developer Center > SQL Server Forums > SQL Server Replication > The format of a message during Web Synchronization was invalid error.
Ask a questionAsk a question
 

AnswerThe format of a message during Web Synchronization was invalid error.

  • Tuesday, November 03, 2009 5:58 PMBrandon Jay Williams Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    My merge replication isn't working properly when I try to replicate large amounts of data.  The error I receive is:

    "The format of a message during Web synchronization was invalid. Ensure that replication components are properly configured at the Web server."

    I've found related topics with some discussion about a problem with having a mix of .NET frameworks.  I will look into this and see if this is the case for me but if so I'm confused why the replication would be working for small amounts of data but not large amounts of data.

Answers

  • Wednesday, November 04, 2009 1:57 AMBrandon Jay Williams Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Ok, I solved my problem.  All of the posts I've seen online have discussed this error occurring because .Net 1.1 was installed on the system.  I checked my publisher and subscriber and this was not the case.  This is not the only reason this error comes up.

    In my case, the reason the error occurred is because I was trying to replicate columns that caused the data and metadata to exceed 25 MB.  Why the SQL Server team chose this number I have no idea.

    In order to solve this problem I had to adjust the merge agent batch size which is measured in generations.  To change this, while starting the merge agent, the number of generations in a batch can be specified using the -DownloadGenerationsPerBatch parameter of the merge agent.  The default is set to 100.

    Here is exactly what was happening:
    -I had an article/table that contained a column which was of the type varbinary(max)
    -The column was storing PDFs which were about 230 KB
    -230 KB x 100 (the default DownloadGenerationsPerBatch) = 22.45 MB

    Even though this number does not exceed 25 MB I believe there must be some metadata or something that gets added by SQL Server that was making my columns exceed the limit.

    Adjusting the -DownloadGenerationsPerBatch parameter to lower number solved this problem for me.

All Replies

  • Tuesday, November 03, 2009 10:50 PMBrandon Jay Williams Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ok, now I'm starting to think it is the amount of data I'm trying replicate that is the issue.  I know there is an advanced server property under "Miscellaneous" called "Max Text Replication Size" which is set to 65k by default.  However, I believe this property is ignored for merge replication.

    Also, I think Web Synchronization uses a default maximum size of 100 MB for the XML file that is used to transfer changes.  From what I've read on MSDN, this can be changed by editing a registry value.  I'm just not too sure if this is the problem I'm having based off of the output log.
  • Wednesday, November 04, 2009 1:57 AMBrandon Jay Williams Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Ok, I solved my problem.  All of the posts I've seen online have discussed this error occurring because .Net 1.1 was installed on the system.  I checked my publisher and subscriber and this was not the case.  This is not the only reason this error comes up.

    In my case, the reason the error occurred is because I was trying to replicate columns that caused the data and metadata to exceed 25 MB.  Why the SQL Server team chose this number I have no idea.

    In order to solve this problem I had to adjust the merge agent batch size which is measured in generations.  To change this, while starting the merge agent, the number of generations in a batch can be specified using the -DownloadGenerationsPerBatch parameter of the merge agent.  The default is set to 100.

    Here is exactly what was happening:
    -I had an article/table that contained a column which was of the type varbinary(max)
    -The column was storing PDFs which were about 230 KB
    -230 KB x 100 (the default DownloadGenerationsPerBatch) = 22.45 MB

    Even though this number does not exceed 25 MB I believe there must be some metadata or something that gets added by SQL Server that was making my columns exceed the limit.

    Adjusting the -DownloadGenerationsPerBatch parameter to lower number solved this problem for me.