Search code examples
microsoft-sync-framework

Microsoft Sync Framework 2 fails in service - Class not registered error


I'm building a file synchronization services using Microsoft Sync Framework 2.

When I run the console Sample application it works fine. When I put the code in a windows service.

I get the error :

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.Synchronization.Files.dll

Additional information: Retrieving the COM class factory for component with CLSID {C201C012-C929-4D72-B9C5-341D48630630} failed due to the following e
rror: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

I can create FileSyncOptions and FileSyncScopeFilter objects even in the service but when I reach

provider = new FileSyncProvider(replicaRootPath, filter, options);

I get the error.

I don't think it's a registration problem with the dll since I can recreate some objects from the same dll.

I even registered the Microsoft.Synchronization dll in the GAC.

What do I need to do to run Microsoft Sync Framework in a windows service ?

Thanks

Thanks


Solution

  • make sure your Sync Framework platform (x86, x64) matches your projects target platform