locked
Initial Sync of Local Database Cache using WCF times out RRS feed

  • Question

  • Hi all,

    I have added a Local Database Cache to my solution and split out the different bits into server and client assemblies. The server assemblies are exposed using a WCF service hosted in IIS7.

    When I first add the tables and what-not in the designer, it performs the initial sync for me just fine. But this is in my dev environment.

    My issue arises when I deploy the WCF service to a production server. I then delete my client side sql compact database and get the Sync Framework to recreate it. This works fine, but then I cannot sync, it just times out.

    I have traces of system.servicemodel, and a sync trace and it looks like it's hanging at the GetChanges method.

    I will post logs, config and code shortly.


    This is the last step of my project and I just want to get it out the door!!! Smile


    Cheers,

    Stu
    • Moved by Tina_Tian Friday, April 22, 2011 8:00 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, October 20, 2008 10:31 PM

Answers

  • And that's where I was wrong. There is data in my SDF. Just an ID10T error on my part, I guess.

    So the solution: Make sure all your CreationDate column values are not the same. As soon as I did this, my batching started working and the data flowed forth. That explains my OutOfMemoryException earlier. It must have been trying to load up all the changes in one batch in memory. Oh well, you live and learn.

    Awesome, I might get to spend a weekend doing NOT work Smile

    Cheers,

    Stu
    Thursday, October 23, 2008 6:31 AM

All replies

  • By looking at my Sync trace, I can see that it is Applying Deletes on the same table over and over again in what seems to be an infinite loop...
    Monday, October 20, 2008 11:41 PM
  • Couple of questions:

     

    • Have you stepped through the code and verified that the correct SyncAdapters are being added to your server provider?
    • Have you stepped through the client side code and verified that SyncTables are successfully added to your configuration class?

    If so, it might be helpful to post the code snippets associated with each of the tasks above.

     

    Sean Kelley

    Program Manager

    Microsoft

     

     

     

    Tuesday, October 21, 2008 2:46 AM
    Moderator
  •  

    Hi Sean,

     

    Thanks for the help. I've stepped through the client, and I can see them getting added there.

     

    The server is a little more difficult since stepping into it involves me establishing a VPN to the server environment and breaking my net connection which I'd be doing the sync over.

     

    However, I can say that I have successfully performed a sync in a LAN environment, but only and incremental one. If I let VS2008 perform the initial sync, I can do incremental syncs after that no problems so that sorta of suggest all the SyncTables and SyncAdapters are set up alright.

     

    Setting breakpoints in the sync itself and exploring some of the SyncSession instances shows me each table as it syncs.

     

    So to reiterate, incremental syncs are fine, just not the initial sync, and only when I use my code. My code does create the SDF + schema, though. Just dies when getting data.

     

    What I would give for the code MS uses in VS2008... Smile

     

     

    A SyncTrace shows an eternal loop of

    INFO   , TournamentManager.vshost, 12, 10/21/2008 03:32:50:337, ----- Client Applying Changes from Server for Group "MembersSyncSyncTableSyncGroup" -----

    INFO   , TournamentManager.vshost, 12, 10/21/2008 03:32:50:338,

    INFO   , TournamentManager.vshost, 12, 10/21/2008 03:32:50:339,    ----- Applying Deletes for Table MembersSync -----

    INFO   , TournamentManager.vshost, 12, 10/21/2008 03:32:50:369,       Deletes Applied: 0

    INFO   , TournamentManager.vshost, 12, 10/21/2008 03:32:50:370,

    INFO   , TournamentManager.vshost, 12, 10/21/2008 03:32:50:377, --- End Client Applying Changes from Server for Group "MembersSyncSyncTableSyncGroup" ---

     

     

    Cheers,

     

    Stu

    Tuesday, October 21, 2008 3:42 AM
  • I should also note that all of this code is designer-generated using the Local Database Cache in VS2008.

     

    I'm now starting to wonder if I've missed a conflict event handler somewhere that's stalling the process.

    Tuesday, October 21, 2008 3:50 AM
  • Hi Sean,

     

    I can confirm now that the SyncAdapters are added to the server provider, and the SyncTables are added to the config class.

     

    My event handlers for conflicts are all good.

     

    I did find that after applying the designer generated sql scripts to the UAT database, that every row in each table had the same value on the CreationDate column. I ran a quick update query to set CreationDate = LastEditDate and now each row has unique values for CreationDate.

     

    This allowed my sync to go all the way through, however nothing was written to my client side SDF. Very weird.

     

    Any ideas?

     

    Thanks,

     

    Stu

    Thursday, October 23, 2008 12:51 AM
  • And that's where I was wrong. There is data in my SDF. Just an ID10T error on my part, I guess.

    So the solution: Make sure all your CreationDate column values are not the same. As soon as I did this, my batching started working and the data flowed forth. That explains my OutOfMemoryException earlier. It must have been trying to load up all the changes in one batch in memory. Oh well, you live and learn.

    Awesome, I might get to spend a weekend doing NOT work Smile

    Cheers,

    Stu
    Thursday, October 23, 2008 6:31 AM