How to Sync Services Using WCF

Written by alexander gokhfeld
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Sync Services Using WCF
Sync services provide faster access to databases. (Jupiterimages/ Images)

Microsoft Sync Framework is data synchronisation software used to synchronise application data with databases. It allows you to plug into synchronisation services provider data stores and manage data exchange without any additional custom programs. Microsoft Sync Services for ADO.NET is the synchronisation provider for synchronising databases using ADO.NET. It is intended for use in the offline applications to cache data locally. The Windows Communication Foundation (WCF) is an application programming interface (API) in the ADO.NET Framework and can be used for the programming of sync services applications.

Skill level:
Moderately Easy


  1. 1

    Download and install the Sync Framework from the Microsoft MSDN website (see Reference 3 for the detailed instructions).

  2. 2

    Click the "Start" button in the Windows and select the "Sync Framework" option from the "All Programs" menu. Click on the "New" option in the "File" menu.

  3. 3

    Select the "WCF Service Library" in the "Library Type" box and type in "WFCSyncServiceP01" in the "Project Name" box to open a new project based on WCF Service Library.

  4. 4

    Double-click the "LocalDataCache1.sync" in the "Configure Data Synchronization" window to open the local data cache file.

  5. 5

    Click on the "Advanced" check box to expand the connection menu and change the Server project location to "WCFSyncServiceP01."

  6. 6

    Click the "OK" button to create the "LocalDataCacheP01.Server.Sync" and "LocalDataCacheP01.Server.SyncContract.vb" synchronisation files.

  7. 7

    Remove "//" comment characters in the server definition section of the "LocalDataCacheP01.Server.SyncContract.vb" file.

  8. 8

    Move the "services" section of the "LocalDataCacheP01.Server.SyncContract.vb" file to the "system.serviceModel" section of the "App.config" file.

  9. 9

    Move the "serviceBehaviors" section of the "LocalDataCacheP01.Server.SyncContract.vb" file to the "behavior" section of the "App.config" file.

  10. 10

    Insert the following code at the beginning of the "LocalDataCacheP01.Server.sync." file:

    Partial Class LocalDataCache1ServerSyncProvider

    Private Sub LocalDataCache1ServerSyncProvider_ApplyChangeFailed _
                  (ByVal sender As Object, _
                   ByVal e As Microsoft.Synchronization.Data.ApplyChangeFailedEventArgs) _
                   Handles Me.ApplyChangeFailed
        e.Action = Microsoft.Synchronization.Data.ApplyAction.RetryWithForceWrite
     End Sub

    End Class.

  11. 11

    Right-click on the "LocalDataCache1.sync" file in the "WFCSyncServiceP01" project window and select the "View" option.

  12. 12

    Add the following under the "OnInitialized" definition section:

    Me.RemoteProvider = New Microsoft.Synchronization.Data.ServerSyncProviderProxy(

    New ServiceReference1.LocalDataCache1SyncContractClient)

    to sync services using WCF.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.