I have been playing with "Microsoft Sync Framework 2.1" to sync two local sql server 2008 databases with an asp.net project.

my code:

```
SqlConnection clientConn = new SqlConnection(@"Server=XXXXXX;User ID=sa; Password=xxxx;Database=ZzzClient");

SqlConnection serverConn = new SqlConnection("Server=XXXXXX;User ID=sa; Password=xxxx;Database=ZzzServer");

SyncOrchestrator syncOrchestrator = new SyncOrchestrator();

syncOrchestrator.LocalProvider = new SqlSyncProvider("InventoryScope", clientConn);
syncOrchestrator.RemoteProvider = new SqlSyncProvider("InventoryScope", serverConn);

syncOrchestrator.Direction = SyncDirectionOrder.UploadAndDownload;

SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();

```

but I get following error when the **Synchronize()** call is executed;

> 
> Retrieving the COM class factory for component with CLSID
>  {EC413D66-6221-4EBB-AC55-4900FB321011} failed due to the following
>  error: 80040154 Class not registered (Exception from HRESULT:
>  0x80040154 (REGDB\_E\_CLASSNOTREG)).
> 
> 
> 

developing envoriement VS 2012, C# asp.net project, framework 4.5
OS:windows 7 Home Prem. (x64)

SyncSDK-v2.1-x64-ENU was installed.

Microsoft.Synchronization

Microsoft.Synchronization.Data

Microsoft.Synchronization.Data.SqlServer

references were added to project from "C:\Program Files\Microsoft Sync Framework\2.1\Runtime".

Both databases provisioned by SqlSyncScopeProvisioning.

I've tried Project Platform Target both x64 ans x86

Any ideas would be greatly appreciated....

![Provisioned databases](https://i.stack.imgur.com/Viiy6.png)

**I've changed the all references from "C:\Program Files (x86)\Microsoft SDKs\Microsoft Sync Framework" to "C:\Program Files\Microsoft Sync Framework\2.1\Runtime"**

![new references](https://i.stack.imgur.com/RbE1O.png)

**And set the Platform Target to x64**
![Platform Target](https://i.stack.imgur.com/99fls.png)

**"Use Local IIS Web Server" is selected**
![Local IIS](https://i.stack.imgur.com/hMA6d.png)

**UPDATE:**
I tried same process with a console application and it worked properly and synchronized all data.

I added following four references to console application;

"c:\Program Files\Microsoft Sync Framework\2.1\Runtime\x64\Microsoft.Synchronization.dll"

c:\Program Files\Microsoft Sync Framework\2.1\Runtime\ADO.NET\V3.1\x64\Microsoft.Synchronization.Data.dll"

"c:\Program Files\Microsoft Sync Framework\2.1\Runtime\ADO.NET\V3.1\x64\Microsoft.Synchronization.Data.Server.dll"

"c:\Program Files\Microsoft Sync Framework\2.1\Runtime\ADO.NET\V3.1\x64\Microsoft.Synchronization.Data.SqlServer.dll"

and set the application's debug properties as following 
![console application's properties](https://i.stack.imgur.com/QPWMe.png)

Same references, same build properties(target to x64) and same code does not work for in Asp.Net project.

> 
> Could not load file or assembly 'WebApplication2' or one of its
>  dependencies. An attempt was made to load a program with an incorrect
>  format.
> 
> 
> 

i guess, web application can't load correct assemblies and tries to load x86 versions