Answered by:
Sync Framework Timeout Expired

Question
-
I am trying to sync a large amount of data between an SQL Server 2008 R2 database and an SQL Server CE 3.5 database. I have encountered the following error:
Cannot enumerate changes at DbServerSyncProvider for table 'TrajectoryRecords' in synchronization group 'TrajectoryRecords'. Check the inner exception for any store-specific errors to determine why the enumeration query failed. ----> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.Sq...).. Priority: High. Timestamp:2013-06-12 12:47:43Z.As near as I can tell, this error is occurring simply because there is so much data that needs to be synchronized that the server can't assemble it all before the timeout is encountered. Is there any way I can increase the timeout?
Wednesday, June 12, 2013 8:17 PM
Answers
-
the SyncAdapters collection in the DBServerSyncProvider has SyncAdapters that has SqlCommands for Select/Insert/Update/Delete, if you can grab the SqlCommand from there, you can set the CommandTimeout on the SqlCommand directly.
plenty of work though.
have a look at how am grabbing those commands here: http://jtabadero.wordpress.com/2010/03/17/adding-filter-to-local-database-cache-generated-sync/, the approach should be similar, except that you're just going to set the CommandTimeout instead
- Marked as answer by Karl Dickman Tuesday, June 18, 2013 7:27 PM
Thursday, June 13, 2013 1:00 AM
All replies
-
the SqlSyncProvider has a CommandTimeout property that you can setThursday, June 13, 2013 12:37 AM
-
The SqlSyncProvider has this class, but the DbServerSyncProvider does not.
The reason why I was asking about the SqlSyncProvider is because I am trying to migrate the existing codebase.
Thursday, June 13, 2013 12:42 AM -
the SyncAdapters collection in the DBServerSyncProvider has SyncAdapters that has SqlCommands for Select/Insert/Update/Delete, if you can grab the SqlCommand from there, you can set the CommandTimeout on the SqlCommand directly.
plenty of work though.
have a look at how am grabbing those commands here: http://jtabadero.wordpress.com/2010/03/17/adding-filter-to-local-database-cache-generated-sync/, the approach should be similar, except that you're just going to set the CommandTimeout instead
- Marked as answer by Karl Dickman Tuesday, June 18, 2013 7:27 PM
Thursday, June 13, 2013 1:00 AM