Microsoft Sync Framework common errors


 

After dealing with Microsoft Sync Framework and a web proxy communication using WCF, I’ve encountered with common errors and issues during development which I then decide to document the most common ones that may help other developers to quickly identify some of problems and fix the bugs.
Here is list of some situations and their thrown exceptions:


Error: SQL Server change tracking has cleaned up tracking information for table ‘[TABLENAME]’. To recover from this error, the client must reinitialize its local database and try to synchronize again

Situation: Connection String is incorrect on client side


Error: Cannot set session parameters in DbServerSyncProvider. Cannot obtain the value for command parameter ‘@CNVOldDossierID’ on command ‘InsertCommand’. Some session parameters must be bound to SyncAdapter and DbServerSyncProvider commands. Please see the Sync Framework online documentation for more information on working with session variables and the parameters required for each command

Situation: Two different databases have been trying to be synced together and it was a connection string issue in this scenario.


Error: SQL Server change tracking has cleaned up tracking information for table ‘[aspnet_Applications]’. To recover from this error, the client must reinitialize its local database and try to synchronize again.

Situation: Apparently some of the changed anchors was left behind what was stored in Anchor table and so could not be retrieved! To fix this issue all of values stored in Anchor table was set to the current CTs of client and server databases

Suggestion: When this happens, the sent anchor value is abnormally below the current CT version of client side DB. To temporary fix it, increase the value in anchor table.


Error: Cannot enumerate changes at DbServerSyncProvider for table ‘TABLENAME’ in synchronization group ‘GROUPNAME’. Check the inner exception for any store-specific errors to determine why the enumeration query failed.

Situation: Application was trying to synchronize the server with a non-synchronized client database (different data sets test from 500 to 100000 records but this is not depending on amount of record)


Error: Cannot enumerate changes at DbServerSyncProvider for table ‘TABLENAME’ in synchronization group ‘GROUPNAME’. Check the inner exception for any store-specific errors to determine why the enumeration query failed

Situation: When this happens, the received anchor value in Anchor table is abnomally below the current CT version of server DB. To fix it, increase the value.


Error: Cannot enumerate changes at DbServerSyncProvider for table ‘TABLENAME’ in synchronization group ‘GROUPNAME’. Check the inner exception for any store-specific errors to determine why the enumeration query failed

Situation: When try to sync with filtering parameters (after a successful normal sync!) – it is resolved when the received anchor value from server db was increased in Anchor table.

Suggestion: Foreign key field of this table was named ‘Dossier_Id’ instead of ‘ContainerDossier’ and this was different from other tables, so after adding filter clause the field could not be found.


Error: Cannot enumerate changes at DbServerSyncProvider for table ‘Doctor’ in synchronization group ‘Dossier_Group’. Check the inner exception for any store-specific errors to determine why the enumeration query failed

Situation: The GUID was not existing in client DB


Error: Cannot obtain a new server anchor. Ensure that you can establish a connection to the server database, and that the SelectNewAnchorCommand property of the DbServerSyncProvider is specified correctly.

Situation: Change was made on syncservice project (undoing bunching functionality on server side) and server 215 was not updated with the new version of syncservice


Error: Invalid object name ‘anchor’

Situation: Problem with anchor table


Error: Cannot set session parameters in DbServerSyncProvider. Cannot obtain the value for command parameter ‘@BirthDate1’ on command ‘InsertCommand’. Some session parameters must be bound to SyncAdapter and DbServerSyncProvider commands. Please see the Sync Framework online documentation for more information on working with session variables and the parameters required for each command.

Situation: When the schema of two databases (client & server) are different.


Error: Unable to connect to the remote server
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 172.64.15.103:80

Situation: The Server was shutdown!


Error: Unable to connect to the remote server
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 172.64.15.103:80

Situation: Our VPN was disconnected!


Error: The remote server returned an error: (415) Cannot process the message because the content type ‘text/xml; charset=utf-8’ was not the expected type ‘application/soap+xml; charset=utf-8’…

Situation: The endpoint binding type is wsHttpBinding and not basicHttpBinding


Error: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Situation: One of the records in one the tables which has datetime field is corrupted somehow!


Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified

Situation: Service Connection string is pointing to incorrect database – database is not accessible for any reason.


Error: Object reference not set to an instance of an object.

Situation (could be): Service connection string’s name is not set properly


Some useful sources are listed here:

http://msdn.microsoft.com/en-us/sync/bb887608
http://msdn.microsoft.com/en-us/library/bb902831.aspx
http://msdn.microsoft.com/en-us/library/bb902829%28v=sql.105%29.aspx
http://msdn.microsoft.com/en-us/sync/bb821992.aspx
http://msdn.microsoft.com/en-us/library/bb902831.aspx
http://msdn.microsoft.com/en-us/library/ff928676.aspx
http://msdn.microsoft.com/en-us/library/dd918908.aspx
http://code.msdn.microsoft.com/Database-SyncSQL-Server-e97d1208
http://www.codeproject.com/Articles/18027/Take-Data-Offline-Using-Microsoft-Synchronization
http://www.8bit.rs/download/samples/SqlExpressClientSyncProvider.cs
http://msdn.microsoft.com/en-us/library/cc305322.aspx
http://msdn.microsoft.com/en-us/library/bb964727.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s