none
Upload fails in N Tier scenario RRS feed

  • Question

  • My app looks like this: Server: SQL-Server, clients using SQL Server CE. The sync is done with a WCF-sync service hosted in IIS. I am using Sync Framework 2.1 and created the sync service and proxy based on the MSDN sample I found: WebSharingAppDemo-CEProviderEndToEnd .

    My app has three scopes: 1) Download: data shared among all users, 2) Download: Filtered data for the specific user 3) Upload: new data (orders) created by the user.

    1) and 2) work perfect but the Upload fails without any errors, just nothing happens. I assume, that I made a mistake when I modified the SqlSyncProviderProxy, SqlSyncService or the ISqlSyncContract.

    I tried: set scope 1) to DownloadUpload entered data on the client. Now I get an error ((400) Bad Request) I suppose due to conflicts, I have not implemented any conflict handling as I only have either download or upload and therefore normally never should have conflicts.

    What should I do to find out why the upload is not working?

    Thanks
    Christian
    Saturday, October 1, 2011 1:36 PM

Answers

  • have you tried starting from a new empty client database?
    • Marked as answer by chl-h Friday, October 14, 2011 9:34 AM
    Wednesday, October 12, 2011 12:18 PM
    Moderator

All replies

  • you can enable sync framework tracing or wcf tracing to see where it's failing.

    or you can subscribe to the changesselected event on the local provider and see if the changes are actually retrieved.

    if it is, you can subscribe to the ApplyChangeFailed event on the remote provider to see if a  conflict or sql error is occuring.

    Sunday, October 2, 2011 12:18 PM
    Moderator
  • Hi JuneT,

    I added some data to tables in sql ce client database that should be uploaded to the sqlserver. After that I synced with trace enabled.

    the trace for the Upload-Scope looks like this:

    BeginSession: ScopeName: UploadOnlyScope, Position: Remote
    INFO   , w3wp, 39, 10/04/2011 15:31:17:748,    BeginSession() called on Provider SqlSyncProvider, Microsoft.Synchronization.Data.SqlServer, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
    GetSyncBatchParameters: Data Source=ServerName\SQL2008R2;Initial Catalog=MyDataBase;User ID=usrMyDataBase;Connect Timeout=1
    ProcessChangeBatch: Data Source=ServerName\SQL2008R2;Initial Catalog=MyDataBase;User ID=usrMyDataBase;Connect Timeout=1
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998, ----- Applying Changes for Scope "UploadOnlyScope" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,         Source Scope Id: 4b531760879b43ae8a1868d4b7d7a554
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    Destination Scope Id: a418799e56ab46dfb43f32c7337b0e73
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Deletes for Table "Table1" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Deletes Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Deletes for Table "Table1" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Deletes for Table "Table2" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Deletes Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Deletes for Table "Table2" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Deletes for Table "Table3" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Deletes Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Deletes for Table "Table3" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Inserts for Table "Table3" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Inserts Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Inserts for Table "Table3" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Inserts for Table "Table2" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Inserts Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Inserts for Table "Table2" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Inserts for Table "Table1" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Inserts Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Inserts for Table "Table1" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Updates for Table "Table3" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Updates Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Updates for Table "Table3" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Updates for Table "Table2" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Updates Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Updates for Table "Table2" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    ----- Updates for Table "Table1" -----
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,       0 Updates Applied
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,    --- End Updates for Table "Table1" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998, --- End Applying Changes for Scope "UploadOnlyScope" ---
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998,
    INFO   , w3wp, 39, 10/04/2011 15:31:17:998, Committing transaction
    EndSession: Data Source=ServerName\SQL2008R2;Initial Catalog=MyDataBase;User ID=usrMyDataBase;Connect Timeout=1
    INFO   , w3wp, 39, 10/04/2011 15:31:18:014,    EndSession() called on Provider SqlSyncProvider, Microsoft.Synchronization.Data.SqlServer, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91

    it seems like there are no records that should be uploaded found.

    If the download works, can I assume that the upload should also work?
    So the error might have to do something with access rights (batchingdirectory or so) or is it also possible that I created a proxy that only works for download (due to some errors or not implemented methods in my code)?

    Thanks
    Christian
    Tuesday, October 4, 2011 4:58 PM
  • what does your trace on the client look like? do you see it picking up the changes at all?

    subscribe to the ChangesSelected event on the local provider. figure out if the changes is being selected at all, then figure out why its not being applied.

    Wednesday, October 5, 2011 2:15 AM
    Moderator
  • Hi JuneT,

    the client trace for the uploadscope looks like this.
    >> do you see it picking up the changes at all?
    So for me this looks like it is not picking up changes at all.


    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:565,    BeginSession() called on Provider SqlCeSyncProvider, Microsoft.Synchronization.Data.SqlServerCe, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:750, Remote data cache size requested: 0 Kb, Local data cache size: 100 Kb
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:750, Enumeration data cache size selected: 100 Kb
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:790, ----- Checking for Outdated Peer -----
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:792,    Destination is not outdated
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:793, --- End Checking for Outdated Peer ---
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:793,
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:796, Memory DataCache Batching enabled. DataCache Size: 100 Kb
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:812,       SyncBatchProducer: Starting Background enumeration thread.
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:833,       SyncBatchProducer: Producer queue empty.  Waiting for queue availablility event
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:894,    RelationalSyncProvider.BatchedEnum: --- End Table "Table1" ---
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:895,
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:908,    RelationalSyncProvider.BatchedEnum: --- End Table "Table2" ---
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:908,
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:912,    RelationalSyncProvider.BatchedEnum: --- End Table "Table3" ---
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:913,
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:914,       RelationalSyncProvider.BatchedEnum: Finished enumerating all adapters.
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:914,       RelationalSyncProvider.BatchedEnum: Adding non batched rows as the last batch. Last batch data size 0 Bytes
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:918,       SyncBatchProducer: Received 1st and last DataSet. Skip to Non batched mode.
    INFO   , MyApp.vshost, 10, 10/05/2011 10:02:06:922,       RelationalSyncProvider.BatchedEnum: Setting BgdEnumInProcess to false, BgdEnumCompleted to True and setting Cancellation event.
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:922,       SyncBatchProducer: Queue availablility event fired
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:06:929, Committing transaction
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:07:208,    EndSession() called on Provider SqlCeSyncProvider, Microsoft.Synchronization.Data.SqlServerCe, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
    INFO   , MyApp.vshost, 7, 10/05/2011 10:02:07:209,       SyncBatchProducer: Canceling Background enumeration thread. Waiting for cancellation event: False


    then I tried to set
     clientprovider.MemoryDataCacheSize = 0 (no caching for upload anyway)
     
     now suddenly the upload seems SOMETIMES to work.
     trace:
     
     INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:631,    BeginSession() called on Provider SqlCeSyncProvider, Microsoft.Synchronization.Data.SqlServerCe, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:791, ----- Checking for Outdated Peer -----
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:793,    Destination is not outdated
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:794, --- End Checking for Outdated Peer ---
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:795,
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:803, ----- Enumerating Changes for Scope "UploadOnlyScope" -----
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:804,          Source Scope Id: 4b531760879b43ae8a1868d4b7d7a554
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:805,     Destination Scope Id: a418799e56ab46dfb43f32c7337b0e73
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:805,    Change Tracking Model: Decoupled
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:806,    ----- Table "Table1" -----
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:865,       Inserts: 1
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:865,       Deletes: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:866,       Updates: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:867,       Changes Enumerated: 1
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:867,    --- End Table "Table1" ---
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:868,
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:877,    ----- Table "Table2" -----
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:882,       Inserts: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:883,       Deletes: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:883,       Updates: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:884,       Changes Enumerated: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:884,    --- End Table "Table2" ---
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:885,
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:887,    ----- Table "Table3" -----
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:891,       Inserts: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:891,       Deletes: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:892,       Updates: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:893,       Changes Enumerated: 0
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:893,    --- End Table "Table3" ---
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:894,
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:895, --- End Enumerating Changes for Scope "UploadOnlyScope" ---
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:896,
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:47:896, Committing transaction
    INFO   , MyApp.vshost, 9, 10/05/2011 10:14:48:451,    EndSession() called on Provider SqlCeSyncProvider, Microsoft.Synchronization.Data.SqlServerCe, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91

    checking the server db, reveals the record was uploaded!

    Unfortunately this only worked a couple of times. I cant quite reproduce when and when not, I probably changed something and now it is not working anymore, no idea why.

    >> figure out if the changes is being selected at all, then figure out why its not being applied.
    What determines what are the changes that should be uploaded?

    I will try to add an eventhandler to ChangesSelected and try to figure out what is happening there.
     
    Thanks
    Christian

    • Edited by chl-h Wednesday, October 5, 2011 10:59 AM
    Wednesday, October 5, 2011 10:56 AM
  • Hi JuneT,

    as you suggested I subscribed to changesSelected like this
    AddHandler clientprovider.ChangesSelected, AddressOf UploadScopeChangesSelected,
    and this SUB
    Private Sub UploadScopeChangesSelected(ByVal sender As Object, ByVal e As DbChangesSelectedEventArgs)
    ' some code, set the breakpoint here
    End Sub

    I tried to see something useful when the the breakpoint got hit. I inspected the various properties of e (DbChangesSelectedEventArgs), like Connection, Context, ScopeMetadata, Session, Transaction.

    Many values I see seem to make sense to me, e.g.:
    -        SyncKnowledge    {ReplicaKeyMap: [(0:a418799e56ab46dfb43f32c7337b0e73) (1:598a5e96981d4199a09f28428d11e44d) (2:4b531760879b43ae8a1868d4b7d7a554)] ScopeRangeSet: [00:[(0:9223372036854775807) (1:1052) (2:774)]]}    Microsoft.Synchronization.SyncKnowledge
    +        ReplicaId    {a418799e56ab46dfb43f32c7337b0e73}    Microsoft.Synchronization.SyncId

    and so on.

    I am not really sure what I should look for.

    I also set the trace level of my app to verbose. Checking the trace I see some (rather complex) SQL statements for the tables that should be uploaded:

    here an example for one table: 

    INFO   , MyApp.vshost, 9, 10/06/2011 10:22:06:246,    ----- Table "Table1" -----
    VERBOSE, MyApp.vshost, 9, 10/06/2011 10:22:06:258,       Executing Command: SELECT [base].[IDGUID], [base].[ID], [base].[CustomerNumber], [base].[PersonalNumber], [base].[column1], [base].[column2], [base].[column3], [base].[column4], [base].[column5], [base].[column6], [base].[column7], [base].[column8], 0 sync_row_is_tombstone, [base].[__sysChangeTxBsn] [sync_row_timestamp], [base].[__sysTrackingContext], COALESCE([base].[__sysInsertTxBsn], 1) [base_create_bsn], [side].[sync_update_bsn] [side_update_bsn], [side].[sync_update_peer_key], [side].[sync_update_peer_timestamp], [side].[sync_create_peer_key], [side].[sync_create_peer_timestamp] FROM [Table1] [base] LEFT JOIN [Table1_tracking] [side] ON ([base].[IDGUID] = [side].[IDGUID]) WHERE (([base].[__sysChangeTxBsn] > @sync_min_timestamp)) UNION ALL SELECT [side].[IDGUID], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', [side].[sync_row_is_tombstone], 0 sync_row_timestamp, cast(NULL as uniqueidentifier) __sysTrackingContext, 0 base_create_bsn, [side].[sync_update_bsn] [side_update_bsn], [side].[sync_update_peer_key], [side].[sync_update_peer_timestamp], [side].[sync_create_peer_key], [side].[sync_create_peer_timestamp] FROM [Table1_tracking] [side]  WHERE (([side].[sync_update_bsn] > @sync_min_timestamp)) AND ([side].[sync_row_is_tombstone] = 1) ORDER BY [base].[IDGUID]
    VERBOSE, MyApp.vshost, 9, 10/06/2011 10:22:06:258,          Parameter: @sync_min_timestamp Value: 774
    INFO   , MyApp.vshost, 9, 10/06/2011 10:22:06:270,       Inserts: 0
    INFO   , MyApp.vshost, 9, 10/06/2011 10:22:06:271,       Deletes: 0
    INFO   , MyApp.vshost, 9, 10/06/2011 10:22:06:271,       Updates: 0
    INFO   , MyApp.vshost, 9, 10/06/2011 10:22:06:272,       Changes Enumerated: 0
    INFO   , MyApp.vshost, 9, 10/06/2011 10:22:06:273,    --- End Table "Table1" ---

    Maybe you can point me in some direction, thanks a lot.

    Christian

    Thursday, October 6, 2011 10:46 AM
  • the Context should have a Dataset that contains the changes. so if you make a change to your local database, the Dataset should be populated with your changes during sync.

    if the changes are being selected, then you should check if those changes make it to the WCF service side or if there's any error uploading the changes (check the WCF trace) or an error writing the batch file on the server side.

    if there's no error in uploading the changes, check the ApplyChangeFailed event to see if there's an error applying the changes to the remote database. 

    Thursday, October 6, 2011 11:13 AM
    Moderator
  • Hi JuneT,

    I added some records at the client, set a breakpoint inside the handler for  ChangesSelected.
    I can see the the Context.DataSet.Tables is populated with the metadata of my tables (column names, datatypes etc.)
    e.g.:
    Context.DataSet.Tables.Count = 3 (my three tables to upload)
    I would expect to find the data selected to upload in Context.DataSet.Tables.List.(number).Rows, but the Context.DataSet.Tables.List.(0).Rows.Count is 0. Does that mean that there is nothing found to sync?

    Maybe I am wrong, but I assumed that by default all records added after a sync will be selected automatically (probably by some magic of the sync framework, with the timestamp or so).

    If I try to understand what is happening and I see the Parameter: @sync_min_timestamp Value: 774 for the SELECT statement (in the trace), shouldn't this select the new records.

    What also puzzles me, is that at some point some records where actually uploaded.

    ApplyingChangeFailed was never hit.

    If get this right it seems that the problem is that there are no changes selected.
    Thursday, October 6, 2011 3:03 PM
  • anything special about how you insert records? any difference when it works and when it doesnt?
    Monday, October 10, 2011 8:30 AM
    Moderator
  • Hi JuneT;

    >> anything special about how you insert records?

    don't Think so. Looks like this:
    setting some default values:

    Private Sub NoteBindingSource_AddingNew(ByVal sender As Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles NoteBindingSource.AddingNew
        Me.MyAppDataSet.Note.IDGUIDColumn.DefaultValue = Guid.NewGuid()
        Me.MyAppDataSet.Note.Create_DateColumn.DefaultValue = Date.Now
        Me.MyAppDataSet.Note.CustomerNumberColumn.DefaultValue = frmMain.CustomerNumber
        Me.MyAppDataSet.Note.PersonalNumberColumn.DefaultValue = My.Settings.PersonalNumber
    End Sub

    and the save:

    Private Sub btn_Note_save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Note_save.Click
        Try
            Me.Validate()
            Me.NoteBindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.MyAppDataSet)
        Catch ex As Exception
            MessageBox.Show("ERROR: " & ex.ToString(), Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
        End Try
    End Sub   



    wcf-trace for that table:
       
    INFO   , MyApp.vshost, 9, 10/10/2011 10:11:43:502,    ----- Table "Note" -----
    VERBOSE, MyApp.vshost, 9, 10/10/2011 10:11:43:503,       Executing Command: SELECT [base].[IDGUID], [base].[CustomerNumber], [base].[PersonalNumber], [base].[Create_Date], [base].[Note], 0 sync_row_is_tombstone, [base].[__sysChangeTxBsn] [sync_row_timestamp], [base].[__sysTrackingContext], COALESCE([base].[__sysInsertTxBsn], 1) [base_create_bsn], [side].[sync_update_bsn] [side_update_bsn], [side].[sync_update_peer_key], [side].[sync_update_peer_timestamp], [side].[sync_create_peer_key], [side].[sync_create_peer_timestamp] FROM [Note] [base] LEFT JOIN [Note_tracking] [side] ON ([base].[IDGUID] = [side].[IDGUID]) WHERE (([base].[__sysChangeTxBsn] > @sync_min_timestamp)) UNION ALL SELECT [side].[IDGUID], NULL, NULL, NULL, '', [side].[sync_row_is_tombstone], 0 sync_row_timestamp, cast(NULL as uniqueidentifier) __sysTrackingContext, 0 base_create_bsn, [side].[sync_update_bsn] [side_update_bsn], [side].[sync_update_peer_key], [side].[sync_update_peer_timestamp], [side].[sync_create_peer_key], [side].[sync_create_peer_timestamp] FROM [Note_tracking] [side]  WHERE (([side].[sync_update_bsn] > @sync_min_timestamp)) AND ([side].[sync_row_is_tombstone] = 1) ORDER BY [base].[IDGUID]
    VERBOSE, MyApp.vshost, 9, 10/10/2011 10:11:43:503,          Parameter: @sync_min_timestamp Value: 774
    INFO   , MyApp.vshost, 9, 10/10/2011 10:11:43:507,       Inserts: 0
    INFO   , MyApp.vshost, 9, 10/10/2011 10:11:43:508,       Deletes: 0
    INFO   , MyApp.vshost, 9, 10/10/2011 10:11:43:509,       Updates: 0
    INFO   , MyApp.vshost, 9, 10/10/2011 10:11:43:509,       Changes Enumerated: 0
    INFO   , MyApp.vshost, 9, 10/10/2011 10:11:43:510,    --- End Table "Note" ---   

    >> any difference when it works and when it doesnt?

    at the moment I cannot reproduce the working state. It is not uploading any changes at all.
    Monday, October 10, 2011 10:29 AM
  • HI JuneT,

    do you have an idea what I could try?

    Thanks

    Christian

    Wednesday, October 12, 2011 9:40 AM
  • have you tried starting from a new empty client database?
    • Marked as answer by chl-h Friday, October 14, 2011 9:34 AM
    Wednesday, October 12, 2011 12:18 PM
    Moderator
  • Hi JuneT,

    thanks for your tip (should have thought about that myself, sigh).  I removed the store from the server db and re-provisioned the db and the client db and all of a sudden it works. Looking at the wcf trace I see that the Parameter: @sync_min_timestamp Value has changed its value from 774 down to 442, whatever that means, everything else being equal. 

    I wonder what is best practice for a real-world app if that kind of problem occurs? I have implemented something like restoring the client - database from an empty database template (simple file copy).

     Thanks again

    Christian

    Friday, October 14, 2011 9:34 AM
  • did you by any chance copy an sdf from one client to the other? as much as possible dont copy a provisioned SDF from a client and used that as a starting point for another client. if you have to, use the generate snapshot api to create a new SDF to initialize new clients.

    or did you do a restore on the server db? if you need to restore from back up, make sure to run postrestorefixup on the restored db.

    Saturday, October 15, 2011 12:58 AM
    Moderator
  • Hi JuneT,

    >> did you by any chance copy an sdf from one client to the other?

    No, after provisioning client and server I took this empty client database as "template" for the clients. However I might have removed the store from the server and re-provisioned and not used the client-db that was generated, but the one from an older provisioning process.

    >> or did you do a restore on the server db?

    Yes, in the development process I did indeed restore the db and also for the testing environment. I never run postrestorefixup on the restored dbs. Might this have led to this effects?

    can safely run postrestorefixup on a db that is already in use by some test-users? Might this even lead to the effect that uploading will work all of sudden?

    thanks
    Christian
    Sunday, October 16, 2011 2:11 PM
  • when you provision a scope, a unique id is assigned to that scope. now when you copy a provisioned database to another client, they will get the same id.

    when you sync to a server, there is a chance that when the first client syncs, the server will record what it synched with that clientid. so when you sync the second client, the server will check what it got from that client already. since the client ids are the same, it will confuse the 2nd client with what was synched by the first client.

    Monday, October 17, 2011 2:19 AM
    Moderator