Demo III: Offline Application – WebService

The N-Tier demo has finally arrived. This demo shows you how to take the server side code, basically the ServerSyncProvider along with all SyncAdapters that we build in the last demo, and expose it as a web service. On the client side, you generate a web service proxy and build a thin wrapper around it to be able to plug it into the sync agent.

Unlike pervious demos, this one needs some security settings to enable the service to access SQL Server. Also the default web service proxy generated by VS won’t comile due to type definition collisions. The steps below show you how to fix all these issues to run the demo smoothly. So please follow them carefully and let me know if you ran into any troubles.

How to install OfflineAppDemo application?

  • Fire SQL server and load demo.sql file
  • Execute the script untill the "test sample" marker
  • load server_procs.sql file and execute it to install server procs
  • Install SyncWebService (see steps below)
  • Load VS solution (OfflineAppDemo-WebService Project)
  • You are ready to go

How to install SyncWebService?

  • Copy SyncWebService directory to c:\interpub\wwwroot
  • From IIS management console, setup the SyncWebService virtual directory as web application and set Application Pool to ASP.NET 2.0   
  • Give network service account read\write access to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
  • Add web reference to the project and give it a name SyncWebServiceProxy
  • Edit the Reference.cs manually and add namespace Microsoft.Synchronization.Data. Also remove code for types that are already defined in Microsoft.Synchronization.Data.dll as the sample reference.cs file shows
  • Add new login to SQL Server for Network Service and give it dbowner access to the pub database

Download Now
: Visit Sync Services Forum

Update: Just to let you know, I left Microsoft to start a new company, Raveable Hotel Reviews. See examples: Romantic Hotels in Myrtle Beach, Best Hotels in Seattle,Top 10 Hotels in Miami, Kid friendly hotels in San Diego, Hotels with a kitchen or kitchenette and 5 Star Hotels in Las Vegas. Your feedback is welcome, raveable blog.

Comments (12)

  1. Q: Are there any demos/samples available A: Yes, the Synchronizer blog has a number of great getting

  2. MSDN Archive says:

    I hear you :). We are still working on them, should be out by end of this week or early next week unless some unforeseen issue blocks us. Please keep an eye on the forum and the blog for updates. Thanks!

  3. Q: Is there a way that I can work with the Microsoft Sync Services without having to write so much code

  4. Over the last couple of days I have been putting together some sample code that will significantly reduce

  5. ccoonen says:

    Howdy, is it possible to continue running this syncing process through a WebService(proxy) but sync Blobs vs’ straight text?

    Thanks, any guidance is muchly appreciated!

  6. MSDN Archive says:

    Hi there,

    I just replied to your post in the forum:


  7. HemantKamalakar says:


    can i test the Webservice against SQL Standard and SQL Express instead of SQL CE?

  8. MSDN Archive says:

    Hi Hemant,

    As I replied to you on the forums, Work is in progess for this. I will blog about it when it is ready. Stay tuned.


  9. apurv_g says:

    Hi Rafik,

    Thanks for such great sample. Can I use this sample for data synchronization in Windows Mobile application?



  10. apurv_g says:

    I am creating a windows mobile application where users will always be in a connected state when synchronizing the data. In that case can I use a webservvice similar to this sample to synchronize data.



  11. apurv_g says:


    You had mentioned that  we need to remove the duplicate types from the generated reference.cs file by using the reference.cs file in the demo as a guide. I could not understand how to use that for removing duplicates. I would appreciate if you can provide some detail on this.



  12. adolfojp says:

    I feel Apurva’s pain. I am having the same problem and I am also clueless on how to remove the duplicates from the reference.cs file.

    Please help.


Skip to main content