In this walk-through you will create a simple Sync service.
You must have the following products installed on your computer to complete this walk-through.
x64 version (SyncSDK-v2.1-x64-ENU.msi) of Sync Framework 2.1 SDK (Microsoft Download Center). The following two x86 redistribution packages of Sync Framework 2.1 from Sync Framework 2.1 Redistributable Packages (Microsoft Download Center).
In this walkthrough, you will be hosting a sync service in the Visual Studio Developer Server, which requires 32-bit components of Sync Framework 2.1 to run the service successfully. If you are actually deploying and hosting the service to IIS or Windows Azure, you just need 64-bit components.
It is not possible have full 32-bit Sync Framework 2.1 SDK installed side-by-side with the 64-bit SDK; therefore you will have to install one version of SDK (64-bit) completely and only selected components of other version (32-bit) of SDK.
In this task you will create code files for the service by using the SyncSvcUtil.exe tool.
..\..\bin\SyncSvcUtil /mode:codegen /target:server /scopeconfig:listdbconfig.xml
The tool creates three files: DefaultScopeEntities.cs, DefaultScopeSyncService.svc, DefaultScopeSyncService.svc.cs in the current folder (C:\Program Files\Microsoft SDKs\Microsoft Sync Framework\4.0\samples\Config). You will use these files later in Task 2 when you create a Visual Studio project. Here is the sample output from the previous command:
Reading specified config file... Generating DbSyncScopeDescription for scope DefaultScope... Generating files... SyncSvcUtil completed with no errors.
Reading specified config file...
Generating DbSyncScopeDescription
for
scope DefaultScope...
Generating files...
SyncSvcUtil completed with no errors.
You can also use the SyncSvcUtilHelper, a UI tool built on top of SyncSvcUtil command-line tool, to generate server side code. See Generating Code for a Server, Generic Client, or Isolated Store Client in the online help for more details.
In this task, you will create a Visual Studio project for the sync service.
Keep the Visual Studio window open. You will use this in the next task to configure the service.
In this task, you will configure the service and build it.
config.ServerConnectionString =
"connection string here"
;
config.SetEnableScope(
"scope name goes here"
);
Data Source=(local);Initial Catalog=listDb;Integrated Security=
true
// configure filter parameters used by the service
config.AddFilterParameterConfiguration(
"userid"
,
"User"
"@ID"
typeof
(System.Guid));
"Item"
"@UserID"
"List"
"TagItemMapping"
// enable Diagnostic Dashboard feature for the service
config.EnableDiagnosticPage =
// enable verbose errors
config.UseVerboseErrors =
For example: http://localhost:<port>/DefaultScopeSyncService.svc/$syncscopes.
http://localhost:<port>/DefaultScopeSyncService.svc
http:/localhost:<port>/DefaultScopeSyncService.svc/$diag.
Maheshkumar S Tiwari edited Revision 14. Comment: Added tags and title casing
TraceYoung_MSFT edited Original. Comment: First Draft
Ed Price MSFT edited Revision 11. Comment: Updated title per style standards.
Ed Price MSFT edited Revision 12. Comment: Specified links are external.
Fantastic article!!